fix: favicon is not displayed when changed in branding settings#1023
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes dynamic favicon updates when branding settings change by ensuring both the SPA and server routes serve the correct, cache-busted favicon asset.
Changes:
- Update the UI branding store to apply the current favicon (custom or default) after load/update/upload/delete actions.
- Add a
/favicon.icoroute that serves the currently configured branding favicon (or falls back to the default SVG) with no-store caching. - Centralize the default favicon SVG constant and add HTTP tests covering the new
.icobehavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| ui/leafwiki-ui/src/stores/branding.ts | Applies favicon changes immediately by updating/creating the <link rel="icon"> element and cache-busting URLs. |
| internal/wiki/branding/routes.go | Adds /favicon.ico and refactors branding asset path resolution for favicon/logo serving. |
| internal/http/router.go | Extracts the default favicon SVG into a shared constant. |
| internal/http/router_test.go | Adds helper + tests verifying /favicon.ico serves custom branding favicon and falls back to SVG with no-store caching. |
Comments suppressed due to low confidence (1)
ui/leafwiki-ui/src/stores/branding.ts:78
updateBrandingforces a favicon reload viaDate.now(), but the store state doesn’t updatefaviconVersion. Components that usefaviconVersionfor cache-busting (e.g. the favicon preview) can keep rendering the old URL even though the document link was updated. Use a singleassetVersionvalue for bothapplyFaviconand the store state (and keep the version update co-located with thefaviconFileupdate).
updateBranding: async (config) => {
set({ isLoading: true, error: null })
try {
const updated = await brandingAPI.updateBranding(config)
applyFavicon(updated.faviconFile, Date.now())
set({
siteName: updated.siteName,
logoFile: updated.logoFile,
faviconFile: updated.faviconFile,
isLoading: false,
})
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.