fix(chat): guard tiptap editor.view access in slash mention#3324
Open
viniciusventura29 wants to merge 1 commit into
Open
fix(chat): guard tiptap editor.view access in slash mention#3324viniciusventura29 wants to merge 1 commit into
viniciusventura29 wants to merge 1 commit into
Conversation
The keyboard listener effect in useMenuNavigation read editor.view.dom before checking editor.isDestroyed. TipTap's view getter throws when the editor is destroyed or not yet mounted, making the underlying guard unreachable. This race fired during navigation transitions (back from settings, opening a new chat), tripping the ChunkErrorBoundary in a remount loop and producing the infinite-loading-chat symptom. Hoist the isDestroyed check above any view access and wrap the editor.view.dom read in try/catch to cover both states. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
Contributor
Release OptionsSuggested: Patch ( React with an emoji to override the release type:
Current version:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
useMenuNavigation(slash mention) readeditor.view.dombefore theeditor.isDestroyedguard. TipTap'sEditor.viewgetter throws[tiptap error]: The editor view is not available...when the editor is destroyed or not yet mounted, making the underlying guard unreachable.ChunkErrorBoundaryin a remount loop — producing the infinite-loading-chat symptom and the recurring error inconnections → back.Fix
In
apps/mesh/src/web/components/chat/tiptap/mention/hooks.ts, hoist theeditor.isDestroyedcheck above anyeditor.viewaccess and wrap theeditor.view.domread intry/catch(covers both destroyed and not-yet-mounted, which throw the same error). On either condition the effect no-ops; React reruns it onceeditorsettles.Test plan
bun run dev, open a new chat / new thread — no error, chat loadsbun run checkpassesbun run fmtclean🤖 Generated with Claude Code
Summary by cubic
Guarded
editor.view.domaccess in the slash-mention handler with an earlyeditor.isDestroyedcheck and a try/catch aroundeditor.view. This prevents view errors, fixing the infinite-loading chat and crashes during navigation (new chat and back from connections/settings).Written for commit 8d4f78d. Summary will update on new commits.