We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ad7b36b commit 835f839Copy full SHA for 835f839
1 file changed
packages/super-editor/src/extensions/comment/comments-plugin.js
@@ -338,12 +338,13 @@ export const CommentsPlugin = Extension.create({
338
const newActiveThreadId = meta.activeThreadId;
339
340
// Emit commentsUpdate event when active comment changes (e.g., from comment bubble click)
341
+ // Defer emission to after transaction completes to avoid dispatching during apply()
342
if (previousActiveThreadId !== newActiveThreadId) {
343
const update = {
344
type: comments_module_events.SELECTED,
345
activeCommentId: newActiveThreadId ? newActiveThreadId : null,
346
};
- editor.emit('commentsUpdate', update);
347
+ setTimeout(() => editor.emit('commentsUpdate', update), 0);
348
}
349
350
pluginState.activeThreadId = newActiveThreadId;
0 commit comments