Tiptap RTE: Ignore no-op transactions in onUpdate to prevent phantom dirty state (closes #22767) - #22781
Conversation
|
Claude finished @AndyButland's task in 1m 44s —— View job PR ReviewTarget: Guards the Tiptap
Suggestions
Approved with Suggestions for improvementGood to go, but please carefully consider the importance of the suggestions. The fix is minimal, correct, and well-scoped. |
There was a problem hiding this comment.
Pull request overview
Prevents the Backoffice workspace from being marked “dirty” by Tiptap “update” events that do not actually modify the document (e.g., the no-op transaction emitted when toggling editability during save), addressing the phantom “Discard Changes” dialog after creating and saving blank RTE content.
Changes:
- Update the Tiptap
onUpdatehandler to ignore transactions wheretransaction.docChangedisfalse, preventing no-op editor state changes from dispatchingUmbChangeEvent.
Description
After creating a blank document with a Rich Text Editor property and clicking Save (without making any changes), the Discard Changes dialog appears spuriously when the workspace redirects from
/createto/edit/<id>.Fixes #22767.
This looks to be happening due to a toggle of the
readonlyproperty on<umb-input-tiptap>around save that's considered a meaningful update to content.To fix I've guarded
onUpdatewithif (!transaction.docChanged) return;. Real user edits are always doc-changing transactions, so they are unaffected. Only the no-op transactions Tiptap emits for editor-state changes (likesetEditable) are filtered out.Testing