Skip to content

Comments

Block Editors: avoid discard changes for no changes (Fixes #20680)#20941

Merged
nielslyngsoe merged 3 commits intorelease/16.4from
v16/hotfix/block-editor-discard-changes
Nov 24, 2025
Merged

Block Editors: avoid discard changes for no changes (Fixes #20680)#20941
nielslyngsoe merged 3 commits intorelease/16.4from
v16/hotfix/block-editor-discard-changes

Conversation

@nielslyngsoe
Copy link
Member

@nielslyngsoe nielslyngsoe commented Nov 24, 2025

Fixes #20680

Fixes cherry-picked from v.17

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue #20680 where block editors (Block List, Block Grid, and RTE with blocks) were prompting users to discard changes even when no actual changes were made. The root cause was that observable value updates were being triggered unnecessarily, causing the change detection system to incorrectly identify unsaved changes.

Key Changes:

  • Imported and used jsonStringComparison utility to compare values before updating them
  • Added early return checks when values are identical to prevent spurious change detection
  • Applied the fix consistently across three block editor components

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Umbraco.Web.UI.Client/src/packages/rte/components/rte-base.element.ts Added value comparison checks in three locations within the observable callback to prevent unnecessary updates when layouts/content/settings haven't changed
src/Umbraco.Web.UI.Client/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts Added value comparison checks in two locations to prevent setting undefined when already undefined and to avoid updates when the new value matches the current value
src/Umbraco.Web.UI.Client/src/packages/block/block-grid/property-editors/block-grid-editor/property-editor-ui-block-grid.element.ts Added value comparison checks in two locations, mirroring the block-list implementation for consistency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants