fix: defer the toolbar tick past Svelte's flush
Tearing down the focused pane's DOM on a layout switch fires blur synchronously inside Svelte's commit; TipTap answers with a focus-meta transaction, and onTransaction's tick write threw state_unsafe_mutation there — aborting the handler before the other panes got the new state. The tick now bumps in a microtask, after the flush, before paint.
This commit is contained in:
1 parent
c6aae13a9e
commit
fb59a30b63
1 file changed
+3
-1
@@ -1063,7 +1063,9 @@ import { EMPTY_PAGE_DECOR, type PageDecor } from '../storage/pageDecor';
|
||||
},
|
||||
},
|
||||
onTransaction: ({ editor: e, transaction }) => {
|
||||
tick++;
|
||||
// Deferred: a blur tr arrives synchronously when a pane-layout switch tears
|
||||
// down the focused DOM — inside Svelte's flush, where a $state write throws.
|
||||
queueMicrotask(() => tick++);
|
||||
// The other pane shows the same state, decorations included.
|
||||
for (const view of paneViews) view?.updateState(e.state);
|
||||
// Mirror this transaction into the labelled undo/redo log for the toolbar's
|
||||
|
||||
Reference in new issue
Block a user