Conversation
applyDelayedPlugins reconfigures ProseMirror's plugin list once its lazily-loaded chunks resolve. Because the plugins array gets a new identity, ProseMirror destroys and recreates every plugin view - including y-prosemirror's cursor plugin, whose destroy handler unconditionally nulls the local awareness 'cursor' field. A user editing before that resolves had their collab cursor silently wiped until their next selection change. Dispatch a no-op transaction right after reconfiguring to force the recreated plugin views through an update pass. Also fixes the flaky multi-window collab e2e test: pins hasFocus() on both pages so cursor broadcast isn't gated on which page/tab holds real browser focus, and replaces flat timeouts with a deterministic wait (plus bounded retry) on the actual yjs awareness state. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Playwright/CDP occasionally drops a single keypress in a run of
keyboard.press('ArrowLeft'/'ArrowRight') calls, leaving the cursor off
by one before the code-mark backticks get typed - producing flaky
failures unrelated to the collab cursor bug (reproduces on main too).
Verify the cursor actually landed where expected via ProseMirror's own
selection state after each movement loop, and press the same key again
to close the gap if a keypress got dropped, instead of trusting the
count blindly.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
mhaack
reviewed
Aug 12, 2026
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
blocks/edit/prose/index.js:applyDelayedPluginsreconfigures ProseMirror's plugin list once lazily-loaded chunks resolve, which gives the plugins array a new identity and makes ProseMirror destroy+recreate every plugin view — including y-prosemirror's cursor plugin, whose destroy handler unconditionally nulls the local awarenesscursorfield. A user editing before that promise resolves had their collab cursor silently wiped until their next selection change. Fixed by dispatching a no-op transaction right afterupdateStateto force the recreated plugin views through an update pass.Collab cursors in multiple editorse2e test: pinshasFocus()on both pages so cursor broadcast isn't gated on which page/tab holds real browser focus (only one can at a time), and replaces flat timeouts with deterministic waits (plus a bounded retry) on the actual yjs awareness state.edit.spec.js's "Add code mark" test (reproduces onmaintoo, confirmed not caused by the above): Playwright/CDP occasionally drops a single keypress in a run of countedArrowLeft/ArrowRightpresses, leaving the cursor off by one before the code-mark backticks get typed (code→ode). Now verifies the cursor actually landed where expected via ProseMirror's own selection state, and presses the same key again to close the gap if one got dropped.Test plan
edit.spec.jssuite 9+ times locally; consistently passing after the arrow-key drift fix (previously flaky ~1-in-3 runs)npx eslintclean on all changed files🤖 Generated with Claude Code