fix(frontend): restore SSR favicon rendering on public pages#433
Merged
fix(frontend): restore SSR favicon rendering on public pages#433
Conversation
Commit 8b01708 ("feat: eliminate FOUC with SSR accent color...") replaced the direct data init of faviconUrl with a null + $effect pattern. $effect never runs during SSR, so the server-rendered HTML always contained the fallback <link rel="icon" href="/favicon.png"> even when a custom favicon was configured. Admin routes masked the bug because they hydrate and navigate as an SPA, where the $effect runs and patches svelte:head client-side. Restore $state(data.faviconUrl) so the initial value is picked up during SSR. $state is still writable, so the existing onMount settings-load and handleFaviconChange event handler keep working. Fixes #432
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #432 — favicon missing on public pages (still shown on admin backend).
Root cause: commit 8b01708 ("feat: eliminate FOUC with SSR accent color, plan config, and palette generation", Mar 28 2026) replaced the direct data-init of faviconUrl with a null +
$effectpattern:$effectnever runs during SSR, so the server-rendered HTML always contained the fallback<link rel="icon" href="/favicon.png">even when a custom favicon was configured. The regression was hidden on admin routes because admin hydrates and navigates as an SPA, so the$effectfires after hydration and patches svelte:head client-side. Public pages are hit more often as fresh SSR loads (direct links, search, social), where the fallback was visible.Fix
Restore
$state(data.faviconUrl)so the initial value is picked up during SSR.$stateremains writable, so the existingonMountsettings-load (line 274) andhandleFaviconChangeevent handler (line 355) keep working unchanged.This restores the intent of PR #345 (commit e0a123b), whose comment
// Initialize from server-loaded data for correct SSRwas preserved through the regression while the line it described was silently gutted.Test plan
cd frontend && npm run check— svelte-check passes (verified, no errors in+layout.svelte)make dev, upload a custom favicon via/admin/settings, hard-reload/and view page source — SSR HTML contains<link rel="icon" type="image/x-icon" href="/api/favicon">, not the/favicon.pngfallback/and/admin— favicon remains correct (writable$statestill updated by onMount/event handler)/— falls back to/favicon.pngas expectedFixes #432