Skip to content

Refresh a project favicon when its icon is clicked#4337

Open
colonelpanic8 wants to merge 3 commits into
pingdotgg:mainfrom
colonelpanic8:feat/favicon-reload-on-click
Open

Refresh a project favicon when its icon is clicked#4337
colonelpanic8 wants to merge 3 commits into
pingdotgg:mainfrom
colonelpanic8:feat/favicon-reload-on-click

Conversation

@colonelpanic8

@colonelpanic8 colonelpanic8 commented Jul 23, 2026

Copy link
Copy Markdown

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. ProjectFavicon now 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 (stopPropagation is 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 pure withProjectFaviconReloadParam(url, nonce) helper (no-op until nonce > 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.svg cached 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.

Cached icon (red on disk→blue) After clicking the sidebar icon
before after

Checklist

  • vp test run packages/shared/src/projectFavicon.test.ts (new helper cases, 4 passed)
  • vp run --filter @t3tools/shared --filter @t3tools/web typecheck
  • vp fmt
  • Integrated browser verification of a live favicon change + click refresh (DOM confirmed faviconReload param 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.

withProjectFaviconReloadParam adds a faviconReload query param only when nonce > 0, keeping the first load on the normal URL. ProjectFaviconImage bumps a reload nonce on click (clicks still bubble to the row), preloads a hidden <img> with the busted URL, and swaps the visible src only 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

  • Clicking the visible favicon in ProjectFaviconImage increments a nonce and preloads a hidden <img> with a faviconReload=<nonce> query param; the visible image swaps only after a successful load.
  • If the initial favicon load fails, the fallback icon becomes clickable to retry the reload.
  • Load and error events from superseded reload attempts are ignored by comparing the active nonce ref to the current nonce state, so rapid clicks don't produce stale updates.
  • Adds withProjectFaviconReloadParam in projectFavicon.ts to append or replace the cache-busting param, leaving the URL unchanged for non-positive nonces.

Macroscope summarized 8ac7eb5.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0b0f2f79-1515-494f-9059-d65d843f80ba

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jul 23, 2026
Comment thread apps/web/src/components/ProjectFavicon.tsx
Comment thread apps/web/src/components/ProjectFavicon.tsx
Comment thread apps/web/src/components/ProjectFavicon.tsx
@macroscopeapp

macroscopeapp Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

@colonelpanic8
colonelpanic8 force-pushed the feat/favicon-reload-on-click branch from 539a53c to 037a276 Compare July 23, 2026 16:11

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread apps/web/src/components/ProjectFavicon.tsx Outdated
@colonelpanic8
colonelpanic8 force-pushed the feat/favicon-reload-on-click branch from 037a276 to 4bd7623 Compare July 23, 2026 16:15
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Jul 23, 2026
@colonelpanic8
colonelpanic8 force-pushed the feat/favicon-reload-on-click branch 2 times, most recently from d3c12f0 to 23083aa Compare July 23, 2026 20:22
colonelpanic8 and others added 3 commits July 23, 2026 13:59
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>
@colonelpanic8
colonelpanic8 force-pushed the feat/favicon-reload-on-click branch from 23083aa to 8ac7eb5 Compare July 23, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant