fix(app): refresh artifact panel when agent modifies the open file - #2939
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
@PriyeshPandey2000 is attempting to deploy a commit to the Different AI Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi @benjaminshafii , would appreciate a review when you get a chance. Happy to address any feedback. |
bd460e5 to
88ed8dd
Compare
|
Rebased the existing PR head onto current Current rebased head: Validation on the rebased head:
The three Vercel failures are fork authorization statuses rather than code/test |
88ed8dd to
68fe31d
Compare
68fe31d to
5395ad0
Compare
Use target.updatedAt (file mtime from server) in the React Query cache key so the panel re-fetches automatically when the agent writes the file. Also include updatedAt in isSameTranscriptArtifactTargets so the Zustand store propagates the change. Add gcTime: 0 so closing and reopening the panel always loads fresh content.
5395ad0 to
1f33e2d
Compare
reachjalil
left a comment
There was a problem hiding this comment.
Thanks @PriyeshPandey2000 — clean, focused fix for stale artifact previews. Verified against current dev. Appreciate the contribution!
Summary
isSameTranscriptArtifactTargetscompared targets only byid, ignoring mtime changes, so the Zustand store never propagated file updates to the panel.staleTime: Infinitywith no cache invalidation meant React Query served the initial fetch indefinitely.target.updatedAt(file mtime already returned byresolveArtifacts) in the React Query cache key and in the transcript-targets equality check. AddgcTime: 0so close/reopen also fetches fresh.Why
When the agent writes a file, the server already returns the updated mtime via
resolveArtifacts. That signal existed in the pipeline but was never used to bust the cache or notify the panel.Issue
Closes #2924
Scope
apps/app/src/react-app/domains/session/artifacts/artifact-panel.tsx— addtarget.updatedAtto query key andsetQueryDatakey; addgcTime: 0apps/app/src/react-app/domains/session/panel/panel-tab-store.ts— includeupdatedAtinisSameTranscriptArtifactTargetsTesting
Ran
pnpm typecheck— passManual
.mdfile, open preview panel, ask agent to modify it — panel updates automatically ✓Evidence