Refresh a project favicon when its icon is clicked - #4337
colonelpanic8 wants to merge 2 commits into
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 This PR adds a simple UI enhancement: clicking a project favicon refreshes its asset URL. The change is small, self-contained, well-documented with comments, and includes test coverage. No security or schema implications. You can customize Macroscope's approvability policy. Learn more. |
539a53c to
037a276
Compare
037a276 to
4bd7623
Compare
709407d to
91fdee1
Compare
Dismissing prior approval to re-evaluate 91fdee1
fa4c785 to
af165bf
Compare
Dismissing prior approval to re-evaluate af165bf
af165bf to
c5dfaca
Compare
bf76e6c to
0152dc7
Compare
0152dc7 to
e28a726
Compare
Dismissing prior approval to re-evaluate e28a726
Project favicon asset URLs are signed tokens that bake in the file the server resolved when the URL was minted, so a project whose icon changed on disk keeps showing the old one until the app reloads. Worse, a project with no icon renders a placeholder rather than an <img>, so there was no way at all to pick up an icon it just gained. Clicking a project icon now re-issues its asset URL. The server resolves the project's icon again, so a newly added, replaced, or moved icon is picked up, and the freshly signed URL also gets the browser past its cached copy. The placeholder is clickable too, and because every instance of a project's icon shares one query, they all refresh together. The click is not consumed, so pressing an icon in a sidebar row still opens the row as before. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
e28a726 to
37604c9
Compare
…on is clicked)
…on is clicked)
|
Note 🤖 GPT-5.6 Sol responding on behalf of Theo We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together. Clicking a favicon to refresh it is hidden behavior that users cannot discover. It adds query-refresh state for an uncommon stale-icon case that a reload already fixes. If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed. |
What Changed
Clicking a project icon now re-issues its asset URL, so the sidebar picks up an icon that changed on disk without reloading the app.
Project favicon asset URLs are signed tokens that bake in the file the server resolved when the URL was minted. Cache-busting that URL is not enough: it keeps pointing at the file the server found last time. And a project with no icon renders a placeholder rather than an
<img>, so previously there was no target to click at all — a project that just gained an icon could never pick it up.apps/web/src/assets/assetUrls.ts: newuseRefreshAssetUrlhook that refreshes theassets.createUrlquery for a resource, making the server resolve it again and mint a freshly signed URL.apps/web/src/components/ProjectFavicon.tsx: clicking the icon — or the placeholder — refreshes it. Because every instance of a project's icon shares one query, they all refresh together. Dropped thekey={src}remount so a refresh swaps the<img>source in place and the loaded image stays on screen while the new bytes decode, instead of flashing back to the placeholder.The click is deliberately not consumed (
stopPropagationis avoided), so pressing an icon in a sidebar row still opens the row as before.Why
When a project's favicon changes, the sidebar icon stays stale until the app reloads. Click-to-refresh gives a direct way to pull the current icon in place — including the common case where a project only just got an icon and was showing the folder placeholder.
UI Changes
Verified live against a real project in an isolated dev environment, in the sidebar v2 project selector. Screenshots are cropped from the sidebar and upscaled 3× so the 14px icon is legible.
favicon.svg(red)favicon.svgdeleted,app/icon.svgadded, blue) — still stale before the clickfavicon.svgtoapp/icon.svg, which cache-busting alone could not dofavicon.svg(green) added, then the placeholder clicked — the icon appearsThe last row is the case the icon-only click handler could not reach: with no
<img>rendered, there was nothing to click.Checklist
vp test run packages/client-runtime/src/state/assets.test.ts(5 passed, incl. new refresh-forwarding case)vp run --filter @t3tools/web --filter @t3tools/client-runtime typecheckvp lint apps/web/src packages/client-runtime/src(no new findings)vp fmt🤖 Generated with Claude Code
Note
Refresh a project favicon by clicking its icon
useRefreshAssetUrlhook in assetUrls.ts that returns a callback to manually re-issue an asset URL query for a given environment and resource.onClickon both the favicon image and the fallback placeholder in ProjectFavicon.tsx, so clicking either triggers a server re-resolve of the project icon.keyfrom the asset URL to${environmentId}:${cwd}, keeping the image mounted across URL refreshes while still remounting when switching projects.Macroscope summarized 37604c9.
Note
Low Risk
Localized UI and asset-query refresh behavior with no auth, data, or API contract changes.
Overview
Clicking a project favicon (or its folder placeholder) now re-issues the signed asset URL so the server resolves the icon from disk again, picking up adds, moves, deletes, or replacements without reloading the app.
Adds
useRefreshAssetUrlinassetUrls.ts, wired throughuseAtomRefreshon the sharedassets.createUrlquery so every instance of that project’s icon refreshes together.ProjectFaviconattaches the refresh handler to both the<img>and the placeholder (via acontentswrapper), and leaves clicks bubbling so sidebar row navigation still works.The image component
keyis now${environmentId}:${cwd}instead ofsrc, so a URL refresh keeps the current image visible while new bytes load instead of remounting and flashing the placeholder. A client-runtime test asserts the asset URL atom exposes arefreshhook for manual re-issue.Reviewed by Cursor Bugbot for commit 37604c9. Bugbot is set up for automated code reviews on this repo. Configure here.