fix(ui): update favicon dynamically based on app theme#4225
Open
GuillaumeLecomte1 wants to merge 2 commits intoDokploy:canaryfrom
Open
fix(ui): update favicon dynamically based on app theme#4225GuillaumeLecomte1 wants to merge 2 commits intoDokploy:canaryfrom
GuillaumeLecomte1 wants to merge 2 commits intoDokploy:canaryfrom
Conversation
Add icon-light.svg and icon-dark.svg with fixed fills (black/white) instead of relying on CSS prefers-color-scheme media query. Update WhitelabelingProvider to use useTheme() and switch favicon based on resolvedTheme (dark/light/unknown). When custom faviconUrl is set, it takes precedence. Closes Dokploy#4100.
The previous implementation returned null when config was not yet loaded, preventing the theme-aware favicon from rendering during initial page load. Now uses optional chaining (config?.metaTitle, config?.customCss) throughout so the <link rel="icon"> always renders with the correct theme-aware favicon regardless of config loading state. Fixes P1 issue from code review.
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
The favicon did not switch between light and dark variants when toggling the app theme because it relied on OS prefers-color-scheme media query instead of the app-level theme state.
Changes
New files:
Modified:
Closes #4100
Greptile Summary
This PR adds two new SVG assets (
icon-dark.svgwith white fill,icon-light.svgwith black fill) and updatesWhitelabelingProviderto select the favicon based onresolvedThemefromnext-themes, so the app-level theme toggle is respected instead of the OS media query.faviconHrefis computed beforeif (!config) return null, but the component still returnsnullwhile config loads, meaning the theme-aware favicon isn't rendered during the initial API call — the non-themed/icon.svgfrom_document.tsxshows until config resolves. The early return should be removed and optional chaining used throughout JSX so the favicon link renders immediately.Confidence Score: 4/5
if (!config) return nullguard prevents the theme-aware favicon from rendering before config resolves, meaning the feature only works after the first API call completes. This is a real behavioral gap in the fix.Reviews (1): Last reviewed commit: "fix(ui): update favicon dynamically base..." | Re-trigger Greptile
(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!