Problem/Motivation

#3033686: Saving Layout override will revert other field values to their values when the Layout was started. fixes the actual data loss, this issue is about how the UI *implies* there is data loss.
Steps to reproduce

  1. Allow custom layout overrides on articles
  2. Create an article with body value "original"
  3. Save article
  4. Open article /layout page
  5. update article at /edit page. set body to "updated"
  6. Open article /layout page
  7. Article body is still "original"
  8. Save layout
  9. Article body is "updated"

Proposed resolution

Whenever an entity is being updated layout override temporarily storage should be updated as well so no stale values are displayed by the Layout Buidler UI

Remaining tasks

Review PR

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

Fixed Layout Builder UI displaying stale entity values if the entity in question has been updated while layout editing is still in progress

CommentFileSizeAuthor
#98 3035992-98.diff14.11 KBevilargest
#74 3035992-nr-bot.txt2.13 KBneeds-review-queue-bot
#72 3035992-nr-bot.txt2.13 KBneeds-review-queue-bot
#59 interdiff_56-59.txt1.14 KBranjith_kumar_k_u
#59 3035992-59.patch13.81 KBranjith_kumar_k_u
#56 3035992-56.patch13.76 KBrishabh vishwakarma
#56 intediff_53_56.txt440 bytesrishabh vishwakarma
#53 interdiff-49-53.txt498 bytesstefdewa
#53 3035992-53.patch13.75 KBstefdewa
#51 3035992-51.patch6.33 KBshubham chandra
#49 interdiff-47-49.txt1.33 KBsmustgrave
#49 3035992-49.patch13.75 KBsmustgrave
#47 interdiff-45-47.txt3.17 KBsmustgrave
#47 3035992-47.patch14.28 KBsmustgrave
#45 interdiff-43-45.txt628 bytesrassoni
#45 3035992-45.patch13.76 KBrassoni
#43 interdiff_41-43.txt1021 bytesranjith_kumar_k_u
#43 3035992-43.patch13.67 KBranjith_kumar_k_u
#42 3035992-42.patch13.63 KBpooja saraah
#41 3035992-40.patch13.62 KBranjith_kumar_k_u
#33 interdiff_27-31.txt673 bytesnikitagupta
#33 3035992-31.patch13.65 KBnikitagupta
#31 interdiff_27-31.txt740 bytesnikitagupta
#31 3035992-31.patch13.68 KBnikitagupta
#27 interdiff_23-27.txt498 bytesprabha1997
#27 3035992-27.patch13.64 KBprabha1997
#23 interdiff_20-23.txt524 bytesneslee canil pinto
#23 3035992-23.patch13.64 KBneslee canil pinto
#20 interdiff_12-20.txt2.02 KBneslee canil pinto
#20 3035992-20.patch13.57 KBneslee canil pinto
#15 Screenshot from 2020-02-13 12-40-33.png193.41 KBdhirendra.mishra
#12 3035992-12.patch13.64 KBbnjmnm
#12 interdiff_6-12.txt18.65 KBbnjmnm
#6 3035992-6.patch5.83 KBbnjmnm

Issue fork drupal-3035992

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tim.plunkett created an issue. See original summary.

tim.plunkett’s picture

Status: Active » Postponed

I should clarify that the issue title and summary assume that #3033686: Saving Layout override will revert other field values to their values when the Layout was started. is committed. Postponing accordingly.

xjm’s picture

Status: Postponed » Active
Issue tags: +Usability

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

bnjmnm’s picture

Assigned: Unassigned » bnjmnm

Assigning to myself to avoid duplicating work. I have a solution working on my local dev enviroment. There's a few additional things I'd like to do then I'll upload the patch and switch back to unassigned.

bnjmnm’s picture

Assigned: bnjmnm » Unassigned
Status: Active » Needs review
StatusFileSize
new5.83 KB

Was having difficulty getting the block edit ID in a Functional test so went with FunctionalJavascript but can refactor if that is addressed.

On entity save, check if a layout override exists in the tempstore for the entity. If yes, update the context of the temporary section storage entity context with a copy of the entity being saved (other than it retaining the value of the layout_builder__layout field from the entity in tempstore.

tim.plunkett’s picture

This is awesome!

  1. +++ b/core/modules/layout_builder/layout_builder.module
    @@ -218,6 +221,45 @@ function layout_builder_entity_delete(EntityInterface $entity) {
    +function layout_builder_entity_update(EntityInterface $entity) {
    

    I think we should use the Drupal::classResolver pattern and have this logic live in an injectable class

  2. +++ b/core/modules/layout_builder/layout_builder.module
    @@ -218,6 +221,45 @@ function layout_builder_entity_delete(EntityInterface $entity) {
    +    $contexts['entity'] = EntityContext::fromEntity($entity);
    +    $contexts['view_mode'] = new Context(new ContextDefinition('string'), 'default');
    

    There's a whole dance in \Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage::deriveContextsFromRoute() (including an @todo) that needs to be done for the view mode.
    Follow-up idea: abstract that out to a public helper method?

  3. +++ b/core/modules/layout_builder/layout_builder.module
    @@ -218,6 +221,45 @@ function layout_builder_entity_delete(EntityInterface $entity) {
    +        $updated_entity->{OverridesSectionStorage::FIELD_NAME} = $stored_entity->{OverridesSectionStorage::FIELD_NAME};
    

    I'm not 100% sure about this, but it seems right. The other thing would be to consider other fields added to the page, see content_moderation_entity_form_display_alter()

Status: Needs review » Needs work

The last submitted patch, 6: 3035992-6.patch, failed testing. View results

tim.plunkett’s picture

+++ b/core/modules/layout_builder/layout_builder.module
@@ -218,6 +221,45 @@ function layout_builder_entity_delete(EntityInterface $entity) {
+    if ($section_storage = $section_storage_manager->load('overrides', $contexts)) {

The failures point out that this running even for non-fieldable entities. One easy solution would be checking instanceof FieldableEntityInterface, but that should be enforced by the constraints on the contexts. That's not happening here. I opened #3046216: SectionStorageManager::load() does not evaluate constraints to look into fixing this

bnjmnm’s picture

@tim.plunkett could you clarify your statement from from #7.3 ?

The other thing would be to consider other fields added to the page, see content_moderation_entity_form_display_alter()

. Does this mean that that the process added in the patch should make to retain any fields added in the manner of content_moderation_entity_form_display_alter(), or that newly-added fields to and entity should be added to overrides similar to how they are added to defaults, or something entirely different from either of those?

tim.plunkett’s picture

\Drupal\Core\Entity\ContentEntityForm::getEditedFieldNames() will give you the machine names of all fields that need to be taken care of, including the OverridesSectionStorage::FIELD_NAME

That's protected, but you should be able to safely borrow the approach.

bnjmnm’s picture

Status: Needs work » Needs review
StatusFileSize
new18.65 KB
new13.64 KB
  1. #7.1
    I think we should use the Drupal::classResolver pattern and have this logic live in an injectable class

    Done.

  2. #7.2
    There's a whole dance in \Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage::deriveContextsFromRoute() (including an @todo) that needs to be done for the view mode.
    Follow-up idea: abstract that out to a public helper method?

    - Abstracted to two methods in LayoutEntityHelperTrait.php

  3. #7.3
    The other thing would be to consider other fields added to the page, see content_moderation_entity_form_display_alter()

    From what I can tell, fields added this way never make it into the tempstore, so they're not subject to the conditions that lead to stale values appearing. If I'm overlooking something, a suggestion on how to cover this use case in tests should be all I need to account for it fully.

  4. #11 Sort of a follow up to item 3^^ , with the current approach I dont think other fields need to be accounted for? The approach in the patch doesn't bother with transfering updated field values. Instead, it just replaces the stored entity context with the one being saved, with the exceoption of the Section Storage Field, since it contains changes that are only present in the tempstore.
  5. #9
    I opened #3046216: SectionStorageManager::load() does not evaluate constraints to look into fixing this

    I adressed this by adding a check for FieldableEntityInterface with a @todo referencing #3046216: SectionStorageManager::load() does not evaluate constraints.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

tim.plunkett’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Needs a reroll, LayoutEntityHelperTrait has changed a lot

dhirendra.mishra’s picture

Status: Needs work » Needs review
StatusFileSize
new193.41 KB

Patch from #12 got successfully applied for me..I have uploaded screenshot.Please check..So moving it to needs review status.

tim.plunkett’s picture

Ahh it doesn't apply cleanly to 9.0, but it does to 8.9

No need to attach screenshots of applying the patch, that just confuses the issue (compared with screenshots of functionality in a browser)

nedsbeds’s picture

Hi, I am not sure if I am running in to this issue or a slightly different one.
Reproduction steps I am following are

Create a basic page with layout builder enabled
Save page
Open article/layout page
Add text block and set block body to "original"
Update block
Save layout
Open article /layout page

Edit text block and set block body to "updated"
Article body is "updated"
Edit text block.
block body is still "original"

It sounds similar since stale data is being shown in the layout builder interface, but am not sure if this is a separate issue that needs raising.
Tested in 8.7 & 8.8

nedsbeds’s picture

Just an update on my previous comment for anyone who lands here, since this is a lot more visible in google.

The issue we were seeing had very similar symptoms to this issue, but was actually caused by https://www.drupal.org/project/layout_builder_st/issues/3067646 symmetric translation module.
The patch in that resolved the issue for us

tim.plunkett’s picture

Version: 8.9.x-dev » 9.1.x-dev
Status: Needs review » Needs work

Needs a reroll for 9.1

neslee canil pinto’s picture

StatusFileSize
new13.57 KB
new2.02 KB
neslee canil pinto’s picture

Status: Needs work » Needs review
tim.plunkett’s picture

Status: Needs review » Needs work
Issue tags: -Needs reroll

Per the test failure: Drupal\Tests\BrowserTestBase::$defaultTheme is required on the newly added FieldValuesTest

neslee canil pinto’s picture

StatusFileSize
new13.64 KB
new524 bytes
jungle’s picture

+++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldValuesTest.php
@@ -27,6 +27,11 @@
+  protected $defaultTheme = 'classy';
+

Classy is not recommended to use, see https://www.drupal.org/node/3083055

As FieldValuesTest is a brand new Test added by the patch, I'd suggest changing to another theme and adjusting/rewriting the tests if necessary.

prabha1997’s picture

Assigned: Unassigned » prabha1997
neslee canil pinto’s picture

Assigned: prabha1997 » Unassigned
prabha1997’s picture

StatusFileSize
new13.64 KB
new498 bytes
prabha1997’s picture

Status: Needs work » Needs review
tim.plunkett’s picture

Status: Needs review » Needs work

Failing tests.

nikitagupta’s picture

Assigned: Unassigned » nikitagupta
nikitagupta’s picture

Status: Needs work » Needs review
StatusFileSize
new13.68 KB
new740 bytes

Fixed failed test cases #27.

Status: Needs review » Needs work

The last submitted patch, 31: 3035992-31.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

nikitagupta’s picture

Status: Needs work » Needs review
StatusFileSize
new13.65 KB
new673 bytes

Please ignore #31
Fixed failed test cases #27.

nikitagupta’s picture

Assigned: nikitagupta » Unassigned

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

tanubansal’s picture

Patch #33 is working fine on 9.1

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

r_cheh’s picture

I reproduced this steps after applying 3035992-31.patch in #33 and it not fixed problem with update layout values.

1. Allow custom layout overrides on articles
2. Create an article with body value "original"
3. Save article
4. Open article /layout page
5. update article at /edit page. set body to "updated"
6. Open article /layout page
7. Article body is still "original"
8. Save layout
9. Article body is "updated"

ranjith_kumar_k_u’s picture

StatusFileSize
new13.62 KB

Rerolled #33

pooja saraah’s picture

StatusFileSize
new13.63 KB

Fixed Failed commands #41

ranjith_kumar_k_u’s picture

StatusFileSize
new13.67 KB
new1021 bytes

Status: Needs review » Needs work

The last submitted patch, 43: 3035992-43.patch, failed testing. View results

rassoni’s picture

Status: Needs work » Needs review
StatusFileSize
new13.76 KB
new628 bytes

Fixed Failed commands on #44
Attached interdiff

Status: Needs review » Needs work

The last submitted patch, 45: 3035992-45.patch, failed testing. View results

smustgrave’s picture

Status: Needs work » Needs review
StatusFileSize
new14.28 KB
new3.17 KB

Fixed deprecation errors and added a check for the route_name

tim.plunkett’s picture

+++ b/core/modules/layout_builder/layout_builder.module
@@ -159,7 +159,7 @@
-  if ($display instanceof LayoutBuilderEntityViewDisplay && strpos($route_name, 'layout_builder.') === 0) {
+  if ($display instanceof LayoutBuilderEntityViewDisplay && str_starts_with($route_name, 'layout_builder.')) {

That function is only in PHP 8 or later, if we intend to land this in D9 at all we need to support PHP 7

smustgrave’s picture

StatusFileSize
new13.75 KB
new1.33 KB

Sorry guess I got ahead of myself.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

shubham chandra’s picture

StatusFileSize
new6.33 KB

Added Patch against #49 in Drupal 10.1.x

bnjmnm’s picture

Status: Needs review » Needs work

#51 was an unnecessary reroll that will not receive credit. It's also an incomplete reroll and misses several changes. Additional work should be based on #49, as #51 breaks several things. As I've mentioned to you several times @Shubham Chandra - you can check if a patch truly needs a reroll by clicking "add test/retest" on the most recent patch and applying it to the most recent Drupal version. Drupal getting a new version doesn't necessarily mean a reroll is needed.

As far as feedback on the #49, it looks like the test added should use stark as the default theme, this will allow it to work on both 9 and 10

stefdewa’s picture

Status: Needs work » Needs review
StatusFileSize
new13.75 KB
new498 bytes

Updated test to use 'stark' instead of 'classy' as default theme.

Status: Needs review » Needs work

The last submitted patch, 53: 3035992-53.patch, failed testing. View results

luke.leber’s picture

+++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldValuesTest.php
@@ -0,0 +1,119 @@
+  protected static $modules = [
+    'layout_builder',
+    'block',
+    'node',
+  ];

We should probably enable the field_ui module here as well. I believe that 4 years ago, field_ui was required by layout builder, but that has since been decoupled.

This should fix the test failure, I believe :-)

I can confirm that #53 fixes the issue on 9.4.12. Here's a dumbed down condition that was reported to us:

Say there are three states:

  • Draft
  • Pending
  • Published

and various transitions:

  • Draft -> Draft
  • Draft -> Pending
  • Pending -> Pending
  • Pending -> Draft
  • Pending -> Published
  • Published -> Draft

and an "Author" only has access to Draft -> Draft, Draft -> Pending, and Published -> Draft.

  1. A piece of content is in "Pending" state, thus an Author has no available transitions, and the edit / layout routes will return 403
  2. A layout override is started, but not saved (only existing in the tempstore)
  3. The content is moved from "Pending" to "Draft"
  4. Authors will now have access to the Edit tab, but not the Layout tab until changes are discarded!

Following applying #53, authors have access to the Edit and Layout tabs appropriately.

Sorry for the long-winded comment -- I can vouch for RTBC once the test fail is resolved.

rishabh vishwakarma’s picture

Version: 10.1.x-dev » 9.5.x-dev
Status: Needs work » Needs review
StatusFileSize
new440 bytes
new13.76 KB

Adding field_ui as mentioned in #55

Status: Needs review » Needs work

The last submitted patch, 56: 3035992-56.patch, failed testing. View results

luke.leber’s picture

+++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldValuesTest.php
@@ -0,0 +1,120 @@
+    $links_block = $assert_session->elementExists('css', '.block-extra-field-blocknodebundle-for-testing-fieldslinks');

Do'h! I think this class used to be added by the Classy theme! This test is now using Stark after #53!

A different CSS selector will have to be used -- I'm not sure off the top of my head exactly what that would be though.

ranjith_kumar_k_u’s picture

StatusFileSize
new13.81 KB
new1.14 KB

Updated the CSS selector, and there is no specific CSS class on the Body field block in the Stark theme

<div data-layout-content-preview-placeholder-label="&quot;Body&quot; field" class="js-layout-builder-block layout-builder-block contextual-region" data-layout-block-uuid="3d159177-0c9a-4e57-bf47-6b5cce1e3fa3" data-layout-builder-highlight-id="3d159177-0c9a-4e57-bf47-6b5cce1e3fa3" draggable="false">

That is why I updated the code like this

    $links_block = $page->findAll('css', ".layout__region--content > .layout-builder-block");
    // The second block is the body field so that is why $links_block[1].
    $links_block_uuid = $links_block[1]->getAttribute('data-layout-block-uuid');

The other test failures from the file "core/modules/layout_builder/tests/src/FunctionalJavascript/FieldValuesTest.php" are because of the following issue
Allow field blocks to display the configuration label when set in Layout Builder

ranjith_kumar_k_u’s picture

Status: Needs work » Needs review
bnjmnm’s picture

Status: Needs review » Needs work

Tests should typically be passing before an issue is set to "Needs Review", especially since it looks like the failure is related to the changes being made.

There are occasional exceptions, and in those cases there should be an explanation as to why it's getting set to "Needs Review" despite failing tests.

ranjith_kumar_k_u’s picture

Version: 9.5.x-dev » 11.x-dev
Status: Needs work » Needs review

Hi, the last patch was failing tests due to the following issue https://www.drupal.org/project/drupal/issues/3039185, now that issue has been fixed on 10.1x and 11x, So here last patch tests are passing now.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

Issue summary is incomplete. If that could be updated please.

Taran2L made their first commit to this issue’s fork.

taran2l’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs issue summary update

So, I've converted #59 to a MR, then fixed a few nitpicks.

My idea of modernizing it a bit is not working as expected, so I've given up on that

Please review

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

Issue summary looks good thanks!

Left some comments on the MR, mostly small stuff

Ran test-only feature

There was 1 error:
1) Drupal\Tests\layout_builder\FunctionalJavascript\FieldValuesTest::testLayoutBuilderUiDoesNotShowStaleEntityFieldValues
Behat\Mink\Exception\ResponseTextException: The text "The changed value" was not found anywhere in the text of the current page.
/builds/issue/drupal-3035992/vendor/behat/mink/src/WebAssert.php:907
/builds/issue/drupal-3035992/vendor/behat/mink/src/WebAssert.php:293
/builds/issue/drupal-3035992/core/tests/Drupal/Tests/WebAssert.php:956
/builds/issue/drupal-3035992/core/modules/layout_builder/tests/src/FunctionalJavascript/FieldValuesTest.php:96
/builds/issue/drupal-3035992/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
ERRORS!
Tests: 1, Assertions: 7, Errors: 1.

So coverage appears to be there.

Looks super close!

taran2l’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Feedback appears to be addressed

Confirmed the issue described in the issue summary has been resolved

#67 mention the test coverage is there

tim.plunkett’s picture

Status: Reviewed & tested by the community » Needs work

Left some suggestions for nits, but also raised a few points that need to be addressed.

taran2l’s picture

Status: Needs work » Needs review
needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new2.13 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

taran2l’s picture

Status: Needs work » Needs review

Bot seems to be wrong, latest MR passes everything and it contains latest changes from the core

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new2.13 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

smustgrave’s picture

Status: Needs work » Needs review
Issue tags: +no-needs-review-bot
smustgrave’s picture

So the review bot has been temporarily turned off as a bug is look at.

But appears the feedback has been addressed but will leave in review for @tim.plunkett to agree.

taran2l’s picture

So, there is one unresolved threadm everything else has been addressed afaik.

smustgrave’s picture

I've also seen using layout_builder__layout as a check has been discouraged before, see #2938129: PageTitle block is non-functional when not handled directly by \Drupal\block\Plugin\DisplayVariant\BlockPageVariant. Though the solution I came up with over there not too sure about, hoping @Tim.plunkett has some better trick.

smustgrave’s picture

@Tim.plunkett do you have a different preferred approach or good to continue with what's there?

tim.plunkett’s picture

Assigned: Unassigned » tim.plunkett
Status: Needs review » Needs work

I will try to look between now and the end of DrupalCon. For now, I'd consider this NW for finding a better way

jastraat’s picture

Just to confirm, this is still an issue with the latest release of Drupal 11.

jastraat’s picture

Status: Needs work » Needs review

I rebased on Drupal 11 and moved the new entity update hook to the hook class with the rest. I'd like to throw this back out for review -

jasongose’s picture

Status: Needs review » Reviewed & tested by the community

This works for me :)

catch’s picture

Status: Reviewed & tested by the community » Needs work

The feedback from Tim Plunkett on the MR hasn't been addressed, and I agree this should do something other than check the route, which feels brittle.

taran2l’s picture

@catch, in #80 @tim.plunkett has self-assigned this issue and no progress for over a year ... is anyone has a better idea on how to overcome this issue without dependency on the route system?

luke.leber’s picture

Crazy idea...but does it really matter if the tempstore entity is updated if the entity was saved with LB? Seems to me at face value that's a premature optimization. Can the route check just be removed...?

tim.plunkett’s picture

Assigned: tim.plunkett » Unassigned
taran2l’s picture

Status: Needs work » Needs review
taran2l’s picture

Implemented @luke.leber suggestion, please review. This should be ready to go in now

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Tested this manually following the steps and did notice the text would update.

Would note I did have to discard my changes in layout builder AFTER I applied the MR for the change to take hold.

luke.leber’s picture

re: #90 - honestly I think that's alright. Sites are no worse off than they are now and given the age of this issue, IMO it should be landed as-is. It at least prevents the situation from happening to new users even if certain rare(?) tempstores aren't automatically flushed.

Don't let perfect be the enemy of good here. 🙏

xjm’s picture

#91 is correct, FWIW. While a TempStore is persistent (state) and therefore not invalidated by the normal update cache clear, it's exactly true that the user is no worse off: Their TempStore contained stale values before the update, and still will after the update. I don't think we would write an update hook to update a TempStore except under exceptional circumstances (security or data integrity issue, for example). According to the title and IS, this is a UX/user expectation problem, but not a data loss problem, so I don't think it merits an upgrade path for TempStores.

danielveza’s picture

Status: Reviewed & tested by the community » Needs work

I really hate to be a pain, if its an easy swap can we please make the test Functional instead of FunctionalJavascript? Layout Builder uses FunctionalJavascript tests for so much, even when no JS is required. I'm trying to move all tests (where possible) to Functional tests so ideally we'd avoid adding too many more.

From a glance I don't see anything here that needs it to be a FunctionalJs test. If I'm incorrect I'm happy for this to be RTBC in it's current state.

taran2l’s picture

Status: Needs work » Needs review

Per great suggestion by @danielveza, I have converted the test to Functional

Hope this can go in finally

smustgrave’s picture

Status: Needs review » Needs work

Left comments in MR.

taran2l’s picture

Status: Needs work » Needs review

addressed feedback

danielveza’s picture

Status: Needs review » Reviewed & tested by the community

This has has many comprehensive reviews already, all feedback has been addressed. I've given it one last sweep, I think this is ready for RTBC

evilargest’s picture

StatusFileSize
new14.11 KB

A diff from the latest MR changes. Works fine on 11.2.4

  • catch committed b8872d05 on 11.x
    Issue #3035992 by xjm, bnjmnm, nikitagupta, ranjith_kumar_k_u,...
catch’s picture

Status: Reviewed & tested by the community » Fixed

This is a tricky one but it looks good. Committed/pushed to 11.x, thanks!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

fengtan changed the visibility of the branch 11.x to hidden.