fix(immich): pass icon as ReactNode, not a component function (fixes startup error on Immich pages) #41

Merged
janpeter merged 1 commit from fix/immich-sync-button-icon-prop into main 2026-06-06 01:19:11 +02:00
Owner

Symptom: the Immich pages (/immich/personen, /immich/dubbelen) show the generic “Startup fout / App kon niet starten” screen. That screen points at /api/ready, but /api/ready returns 200 (DB is fine) — a red herring.

Cause: both pages are Server Components and passed icon={RefreshCw} — a lucide component function — to the client component ImmichSyncButton. Passing a function across the Server→Client boundary throws at render: “Functions cannot be passed directly to Client Components” (digest 1109689143), which surfaces as the startup-error fallback.

Fix: change ImmichSyncButton's icon prop from LucideIcon to ReactNode and render the passed element; call sites now pass icon={<RefreshCw />} (a serializable element). Behaviour is unchanged — the pending state still swaps to a spinner.

Verified: lint clean (0 errors); npm run build compiles successfully; the button's own test passes; full suite is 112 pass / 36 fail identical to main (pre-existing stale-scanner / DB-dependent test failures, unrelated to this change).

Note for later (separate): the test suite is substantially red on main (36/148) — mostly leftover scanner tests that the library rebuild should have removed, plus tests needing a live DB.

**Symptom:** the Immich pages (`/immich/personen`, `/immich/dubbelen`) show the generic *“Startup fout / App kon niet starten”* screen. That screen points at `/api/ready`, but `/api/ready` returns **200** (DB is fine) — a red herring. **Cause:** both pages are Server Components and passed `icon={RefreshCw}` — a lucide component *function* — to the **client** component `ImmichSyncButton`. Passing a function across the Server→Client boundary throws at render: *“Functions cannot be passed directly to Client Components”* (digest **1109689143**), which surfaces as the startup-error fallback. **Fix:** change `ImmichSyncButton`'s `icon` prop from `LucideIcon` to `ReactNode` and render the passed element; call sites now pass `icon={<RefreshCw />}` (a serializable element). Behaviour is unchanged — the pending state still swaps to a spinner. **Verified:** lint clean (0 errors); `npm run build` compiles successfully; the button's own test passes; full suite is 112 pass / 36 fail **identical to `main`** (pre-existing stale-scanner / DB-dependent test failures, unrelated to this change). Note for later (separate): the test suite is substantially red on `main` (36/148) — mostly leftover scanner tests that the library rebuild should have removed, plus tests needing a live DB.
fix(immich): pass icon as ReactNode, not a component function
Some checks failed
CI / docker-build (pull_request) Failing after 3s
33b71e0e80
The Immich personen/dubbelen pages (Server Components) passed
icon={RefreshCw} — a lucide component *function* — to the client
component ImmichSyncButton. Passing a function across the RSC boundary
throws at render: 'Functions cannot be passed directly to Client
Components' (digest 1109689143), so the Immich pages showed the generic
startup-error screen (/api/ready was 200 — not a DB issue).

Change ImmichSyncButton's icon prop to ReactNode and render the passed
element; call sites now pass icon={<RefreshCw />} (a serializable
element). Behaviour unchanged; pending state still swaps to a spinner.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
janpeter/Media-Organizer!41
No description provided.