Refresh a project favicon when its icon is clicked#4337
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved Self-contained UI enhancement adding click-to-refresh for project favicons. The majority of additions are tests, and the implementation is isolated cache-busting logic with no backend or schema impact. You can customize Macroscope's approvability policy. Learn more. |
539a53c to
037a276
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 037a276. Configure here.
037a276 to
4bd7623
Compare
d3c12f0 to
23083aa
Compare
Project favicon asset URLs are derived from the project path and stay stable when the underlying favicon file changes, so the browser keeps serving the cached image until a full app reload. Clicking a favicon now bumps a per-icon cache-busting query param, forcing a re-fetch. The click is not consumed, so it still bubbles to the row and opens the thread — pressing the icon both opens the thread and refreshes the icon. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
23083aa to
8ac7eb5
Compare

What Changed
Clicking a project favicon now forces it to re-fetch, so an edited project icon updates without reloading the whole app.
Project favicon asset URLs are derived from the project path and stay stable when the underlying favicon file changes on disk. The browser therefore keeps serving the cached image bytes until a full app reload.
ProjectFaviconnow keeps a per-icon reload nonce; clicking the icon bumps it and appends a cache-busting query parameter to the<img>src, forcing a fresh request. The click is not consumed (stopPropagationis intentionally avoided), so it still bubbles to the surrounding row — pressing the icon both opens the thread and refreshes the icon.packages/shared/src/projectFavicon.ts: new purewithProjectFaviconReloadParam(url, nonce)helper (no-op untilnonce > 0, keeping first paint on the shared cache-friendly URL).apps/web/src/components/ProjectFavicon.tsx: reload nonce + click handler; only the query string changes, so the same<img>element is reused and the loaded image stays on screen while the fresh bytes arrive (no flash back to the fallback).Why
When a project's favicon changes, the sidebar/breadcrumb icon stays stale until you reload the app. A click-to-refresh gives a direct, discoverable way to pull the latest icon in place.
UI Changes
Verified live: with a red
favicon.svgcached in the browser, the file was changed to blue on disk and the sidebar icon was clicked (no app reload). The clicked sidebar icon re-fetched to blue while the un-clicked breadcrumb icon stayed on its cached red — demonstrating the per-icon refresh — and the click also opened the thread.Checklist
vp test run packages/shared/src/projectFavicon.test.ts(new helper cases, 4 passed)vp run --filter @t3tools/shared --filter @t3tools/web typecheckvp fmtfaviconReloadparam on the clicked icon only)🤖 Generated with Claude Code
Note
Low Risk
Scoped UI/asset loading behavior with no auth, data, or API contract changes beyond optional query params on favicon URLs.
Overview
Clicking a project favicon now triggers a cache-busting re-fetch so an updated on-disk icon can show up without reloading the app.
withProjectFaviconReloadParamadds afaviconReloadquery param only whennonce > 0, keeping the first load on the normal URL.ProjectFaviconImagebumps a reload nonce on click (clicks still bubble to the row), preloads a hidden<img>with the busted URL, and swaps the visiblesrconly after a successful load so the current icon does not flash away.Failed initial loads get a clickable fallback to retry. Load/error handlers compare an active nonce ref to ignore events from superseded reloads when users click rapidly.
Reviewed by Cursor Bugbot for commit 8ac7eb5. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Refresh a project favicon by clicking it to trigger a cache-busting reload
ProjectFaviconImageincrements a nonce and preloads a hidden<img>with afaviconReload=<nonce>query param; the visible image swaps only after a successful load.withProjectFaviconReloadParamin projectFavicon.ts to append or replace the cache-busting param, leaving the URL unchanged for non-positive nonces.Macroscope summarized 8ac7eb5.