Repository navigation
fix canvas staying open after starting a New Chat - #7229
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors artifact auto-open and panel visibility logic. In chat-page.tsx, checks for newThreadNonce are removed to simplify when the artifact panel is shown or closed. In artifact-card.tsx, a ref is introduced to prevent stale auto-opens on view-change cleanup. However, the reviewer pointed out a critical issue: using a simple boolean flag (autoOpenAttemptedRef) will break streaming preview updates for markdown code fence artifacts because their IDs change dynamically with each stream chunk. The reviewer provided a code suggestion to track the last auto-opened artifact ID instead.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c42400d0bc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Clicking New Chat while an HTML canvas was open could leave the old thread's canvas visible in the fresh chat. The New Chat cleanup clears the auto-opened-artifact memory and closes the surface, but the old thread's message cards can still be mounted for one more render when the runtime thread switch lands late the close re-triggered ArtifactCard's auto-open effect (it depends on selectedArtifactId), which found the memory cleared and reopened the canvas. The fresh-chat view then displayed it because showArtifactPanel accepted any selected artifact when a new-thread nonce was set, and nothing closed it afterward.
Fix: auto-open at most once per mounted card, require artifacts to belong to the active thread before showing the panel on non-thread views, and extend the fallback close to new-chat nonce views.