Skip to content

Avoid double editor transaction application#5909

Merged
ComputelessComputer merged 2 commits into
mainfrom
fix/avoid-double-editor-transaction-apply
Jul 4, 2026
Merged

Avoid double editor transaction application#5909
ComputelessComputer merged 2 commits into
mainfrom
fix/avoid-double-editor-transaction-apply

Conversation

@ComputelessComputer

@ComputelessComputer ComputelessComputer commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Move editor change notifications into a ProseMirror plugin view update and cancel pending debounced note saves before external state sync.


Note

Medium Risk
Touches how note/chat content is persisted and synced; behavior is covered by new plugin tests but regressions in save timing or missed updates are possible.

Overview
Stops using a custom dispatchTransaction on chat and note ProseMirror editors (and the dispatchEditorTransaction helper for onUpdate / handleChange), so transactions are not applied twice when the host library already dispatches them.

Change detection moves into a new docChangeListenerPlugin that runs in the plugin view update hook and calls back only when the document changed as part of a transaction—not on selection-only updates or when the doc is replaced via view.updateState during controlled initialContent sync.

For the note editor, pending debounced saves are cancelled (onUpdate.cancel()) before that external sync, and the debounced handler receives JSON from the plugin instead of re-reading the view inside flushChange.

Reviewed by Cursor Bugbot for commit 060880f. Bugbot is set up for automated code reviews on this repo. Configure here.

@netlify

netlify Bot commented Jul 4, 2026

Copy link
Copy Markdown

Deploy Preview for old-char canceled.

Name Link
🔨 Latest commit 060880f
🔍 Latest deploy log https://app.netlify.com/projects/old-char/deploys/6a48abb72feab300086115a4

@ComputelessComputer ComputelessComputer force-pushed the fix/avoid-double-editor-transaction-apply branch from 73d8d57 to 456f3a3 Compare July 4, 2026 04:42
@ComputelessComputer ComputelessComputer changed the base branch from main to fix/reduce-session-action-render-cost July 4, 2026 04:42
@ComputelessComputer ComputelessComputer force-pushed the fix/reduce-session-action-render-cost branch from 625568f to e7a2eb1 Compare July 4, 2026 05:06
@ComputelessComputer ComputelessComputer force-pushed the fix/avoid-double-editor-transaction-apply branch from 456f3a3 to 0bc5ce8 Compare July 4, 2026 05:06
@ComputelessComputer ComputelessComputer force-pushed the fix/reduce-session-action-render-cost branch from e7a2eb1 to 7a36050 Compare July 4, 2026 05:34
@ComputelessComputer ComputelessComputer force-pushed the fix/avoid-double-editor-transaction-apply branch from 0bc5ce8 to 16d00bd Compare July 4, 2026 05:34
@ComputelessComputer ComputelessComputer force-pushed the fix/reduce-session-action-render-cost branch from 7a36050 to 7bfdd35 Compare July 4, 2026 05:57
@ComputelessComputer ComputelessComputer force-pushed the fix/avoid-double-editor-transaction-apply branch from 16d00bd to 63793fa Compare July 4, 2026 05:57
@ComputelessComputer ComputelessComputer force-pushed the fix/reduce-session-action-render-cost branch from 7bfdd35 to 96364af Compare July 4, 2026 06:16
@ComputelessComputer ComputelessComputer force-pushed the fix/avoid-double-editor-transaction-apply branch from 63793fa to 326f4ab Compare July 4, 2026 06:16
@ComputelessComputer ComputelessComputer force-pushed the fix/reduce-session-action-render-cost branch from 96364af to fb04600 Compare July 4, 2026 06:35
@ComputelessComputer ComputelessComputer force-pushed the fix/avoid-double-editor-transaction-apply branch from 326f4ab to 2ae2648 Compare July 4, 2026 06:35
@ComputelessComputer ComputelessComputer force-pushed the fix/reduce-session-action-render-cost branch from fb04600 to fc6e88a Compare July 4, 2026 06:39
@ComputelessComputer ComputelessComputer force-pushed the fix/avoid-double-editor-transaction-apply branch from 2ae2648 to b91ab61 Compare July 4, 2026 06:39
@ComputelessComputer ComputelessComputer force-pushed the fix/reduce-session-action-render-cost branch from fc6e88a to a561f6c Compare July 4, 2026 06:42
@ComputelessComputer ComputelessComputer force-pushed the fix/avoid-double-editor-transaction-apply branch from b91ab61 to ffb2bb6 Compare July 4, 2026 06:42
@ComputelessComputer ComputelessComputer force-pushed the fix/reduce-session-action-render-cost branch from a561f6c to 0838e9e Compare July 4, 2026 06:43
@ComputelessComputer ComputelessComputer force-pushed the fix/avoid-double-editor-transaction-apply branch from ffb2bb6 to 7081a61 Compare July 4, 2026 06:43
Move editor change notifications into a ProseMirror plugin view update and remove custom dispatch handlers that re-applied transactions in uncontrolled React ProseMirror editors.
@ComputelessComputer ComputelessComputer changed the base branch from fix/reduce-session-action-render-cost to main July 4, 2026 06:44
@ComputelessComputer ComputelessComputer force-pushed the fix/avoid-double-editor-transaction-apply branch from 7081a61 to 060880f Compare July 4, 2026 06:44
@ComputelessComputer ComputelessComputer merged commit b7d2a16 into main Jul 4, 2026
16 checks passed
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