Skip to content

fix canvas staying open after starting a New Chat - #7229

Merged
shimmyshimmer merged 1 commit into
unslothai:mainfrom
NilayYadav:fix-canvas-new-chat
Jul 19, 2026
Merged

shimmyshimmer merged 1 commit into
unslothai:mainfrom
NilayYadav:fix-canvas-new-chat

Conversation

@NilayYadav

Copy link
Copy Markdown
Collaborator

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.

@gemini-code-assist gemini-code-assist 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.

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

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

@shimmyshimmer
shimmyshimmer merged commit d8aa0df into unslothai:main Jul 19, 2026
36 checks passed
VectorCipher pushed a commit to VectorCipher/unsloth that referenced this pull request Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants