Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 299251

"Unsaved changes" message incorrectly appears on layout builder

$
0
0

Problem/Motivation

After the initial load of a layout builder edit page (either per-entity overrides or the per-display defaults), any subsequent visits to the page will trigger a "You have unsaved changes" message, even when no changes have been made.

(this bug was introduced by #3144010: New pseudo-fields cannot be removed, InvalidArgumentException thrown)

Steps to reproduce

Scenario 1:

  1. Enable layout builder for a content type.
  2. Click the "Manage layout" link.
  3. Refresh the page.

Scenario 2:

  1. Enable layout builder for a content type, and allow each content item to have its layout customized.
  2. Create a node.
  3. Click the "Layout" tab.
  4. Refresh the page.

Actual result: "You have unsaved changes" message appears.
Expected result: The message should not appear, since there are no unsaved changes.

Proposed resolution

Update LayoutTempstoreRepository so that it can explicitly keep track of whether any given SectionStorage in the repository has unsaved changes.

Remaining tasks

Review

User interface changes

The "You have unsaved changes" message will only appear when you have unsaved changes

API changes

LayoutTempstoreRepositoryInterface has a new public hasUnsavedChanges() function. Note that this interface has a one-to-one correspondence with the LayoutTempstoreRepository class, so we can add functions without breaking any BC rules.

In addition, LayoutTempstoreRepositoryInterface::set() has a new optional boolean argument called $has_unsaved_changes, which is used to track whether there are unsaved changes in the SectionStorage being set.

Data model changes

N/A

Release notes snippet

N/A


Viewing all articles
Browse latest Browse all 299251

Latest Images

Trending Articles



Latest Images