fix: album assignment + approval error handling
Album assignment 500'd with IMMICH_UNAVAILABLE because grantAlbum verified the
album via getAlbum, which pulled the full album incl. all assets — large albums
blew the 15s timeout. Request ?withoutAssets=true so Immich returns metadata
only (no consumer reads .assets); make assets optional in the schema.
Album thumbnails 500'd because next/image rejected the ?albumId= query string
(images.localPatterns). Switch the album page to a plain <img>, matching the
editorial catalog (next/image was used in exactly one place).
Overhaul action error handling: grantAlbumAction/revokeAlbumAction/approveEditorialAction
returned a thrown Error, which Next.js turns into an opaque error-digest page —
the German message never reached the admin. They now return {ok,message}; new
client AlbumGrantForm + ApproveForm use useActionState to show the message
inline. Auth (requireAdmin) still throws (guarded by the layout). Update both
action test files to the result contract.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
7aeceee078
commit
089f5f7035
9 files changed
+233
-60
No files matched your search
@@ -43,7 +43,10 @@ const albumSummarySchema = z
|
||||
.passthrough();
|
||||
|
||||
const albumSchema = albumSummarySchema.extend({
|
||||
assets: z.array(assetSchema),
|
||||
// `getAlbum` requests `?withoutAssets=true` so Immich returns album metadata
|
||||
// without the full asset list — otherwise large albums blow past the request
|
||||
// timeout and surface as IMMICH_UNAVAILABLE. No consumer reads `.assets`.
|
||||
assets: z.array(assetSchema).optional().default([]),
|
||||
});
|
||||
|
||||
const metadataSearchSchema = z
|
||||
@@ -324,7 +327,7 @@ export function createImmichClient({
|
||||
},
|
||||
getAlbum(albumId, signal) {
|
||||
return requestJson<ImmichAlbum>(
|
||||
`/albums/${encodeURIComponent(albumId)}`,
|
||||
`/albums/${encodeURIComponent(albumId)}?withoutAssets=true`,
|
||||
{ method: "GET" },
|
||||
albumSchema,
|
||||
signal,
|
||||
|
||||
Reference in new issue
Block a user