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:
- Enable layout builder for a content type.
- Click the "Manage layout" link.
- Refresh the page.
Scenario 2:
- Enable layout builder for a content type, and allow each content item to have its layout customized.
- Create a node.
- Click the "Layout" tab.
- 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