Newly added menu links are invisible until published

Created on 4 April 2024, 7 months ago
Updated 6 May 2024, 5 months ago

Problem/Motivation

When adding a new menu link in a workspace, it does not show up in the UI until the change is pushed all the way to Live. It looks like that was supposed to be fixed in [3040258]. Note that renaming a link works as expected.

Steps to reproduce

Be in a workspace. Add a new menu link. See that it is not in the UI. Publish to Live. See that it is now visible in the UI.

Proposed resolution

Ensure that newly-created entities are marked as the default revision in \Drupal\workspaces\EntityOperations::entityPresave(), so that code like \Drupal\menu_link_content\Entity\MenuLinkContent::postSave() can run correctly for the initial revision created in a workspace.

Also, \Drupal\workspaces\EntityOperations::entityFormEntityBuild() needs to set the "new revision" flag to fully match what we're doing in ::entityPresave().

Remaining tasks

Review.

🐛 Bug report
Status

Fixed

Version

10.3

Component
Workspaces 

Last updated 3 days ago

No maintainer
Created by

🇺🇸United States michelle Wisconsin, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @michelle
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇺🇸United States DamienMcKenna NH, USA
  • 🇺🇸United States DamienMcKenna NH, USA
  • 🇷🇴Romania amateescu

    I was 100% sure we had test coverage for this, so I looked into it and turns out it's a problem that can only be reproduced in the UI, and even though WorkspaceMenuLinkContentIntegrationTest is a functional test, it's doing CRUD operations on menu links via API calls :/

  • Pipeline finished with Failed
    6 months ago
    Total: 176s
    #149334
  • Status changed to Needs review 6 months ago
  • 🇷🇴Romania amateescu

    Opened a MR for it, and the bug can be easily tested by changing the existing coverage to do menu link operations via the UI, as it should :)

    Btw, the problem is not only for sub workspaces, top-level ones have the same issue.

  • Pipeline finished with Success
    6 months ago
    Total: 991s
    #149354
  • Status changed to RTBC 6 months ago
  • 🇺🇸United States smustgrave

    Following the steps

    1. Standard Drupal install
    2. Enable workspaces
    3. Go to stage space
    4. Create a menu link
    5. Go back to live space
    6. Don't see menu link

    Applying MR fixes the problem.

    1) Drupal\Tests\workspaces\Functional\WorkspaceMenuLinkContentIntegrationTest::testWorkspacesWithCustomMenuLinks
    Behat\Mink\Exception\ExpectationException: Link with label stage link not found.
    /builds/issue/drupal-3438771/core/tests/Drupal/Tests/WebAssert.php:587
    /builds/issue/drupal-3438771/core/tests/Drupal/Tests/WebAssert.php:313
    /builds/issue/drupal-3438771/core/modules/workspaces/tests/src/Functional/WorkspaceMenuLinkContentIntegrationTest.php:106
    /builds/issue/drupal-3438771/vendor/phpunit/phpunit/src/Framework/TestResult.php:729
    ERRORS!
    Tests: 1, Assertions: 14, Errors: 1.
    

    Shows the test coverage

    • catch committed 01dd63eb on 10.3.x
      Issue #3438771 by amateescu, Michelle, smustgrave: Newly added menu...
    • catch committed 1522a33e on 11.x
      Issue #3438771 by amateescu, Michelle, smustgrave: Newly added menu...
  • Status changed to Fixed 6 months ago
  • 🇬🇧United Kingdom catch

    Committed/pushed to 11.x and cherry-picked 10.3.x, thanks!

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

Production build 0.71.5 2024