Skip to content

fix(chat): guard tiptap editor.view access in slash mention#3324

Open
viniciusventura29 wants to merge 1 commit into
mainfrom
viniciusventura29/fix-slash-mention-editor-view-v1
Open

fix(chat): guard tiptap editor.view access in slash mention#3324
viniciusventura29 wants to merge 1 commit into
mainfrom
viniciusventura29/fix-slash-mention-editor-view-v1

Conversation

@viniciusventura29
Copy link
Copy Markdown
Contributor

@viniciusventura29 viniciusventura29 commented May 9, 2026

Summary

  • useMenuNavigation (slash mention) read editor.view.dom before the editor.isDestroyed guard. TipTap's Editor.view getter throws [tiptap error]: The editor view is not available... 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 ChunkErrorBoundary in a remount loop — producing the infinite-loading-chat symptom and the recurring error in connections → back.

Fix

In apps/mesh/src/web/components/chat/tiptap/mention/hooks.ts, hoist the editor.isDestroyed check above any editor.view access and wrap the editor.view.dom read in try/catch (covers both destroyed and not-yet-mounted, which throw the same error). On either condition the effect no-ops; React reruns it once editor settles.

Test plan

  • bun run dev, open a new chat / new thread — no error, chat loads
  • Connections → pick a connection → click back — returns to previous view without throwing
  • bun run check passes
  • bun run fmt clean

🤖 Generated with Claude Code


Summary by cubic

Guarded editor.view.dom access in the slash-mention handler with an early editor.isDestroyed check and a try/catch around editor.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.

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>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 9, 2026

🧪 Benchmark

Should we run the Virtual MCP strategy benchmark for this PR?

React with 👍 to run the benchmark.

Reaction Action
👍 Run quick benchmark (10 & 128 tools)

Benchmark will run on the next push after you react.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 9, 2026

Release Options

Suggested: Patch (2.311.11) — based on fix: prefix

React with an emoji to override the release type:

Reaction Type Next Version
👍 Prerelease 2.311.11-alpha.1
🎉 Patch 2.311.11
❤️ Minor 2.312.0
🚀 Major 3.0.0

Current version: 2.311.10

Note: If multiple reactions exist, the smallest bump wins. If no reactions, the suggested bump is used (default: patch).

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.

1 participant