Layout builder blocks do not appear if layout edit page is not saved first

Created on 7 March 2023, almost 2 years ago
Updated 2 July 2024, 6 months ago

Problem/Motivation

If you add a paragraph to an existing layout page and save. You must also save the layout edit page first before the new paragraph will show up on the list of blocks available.

Modules enabled:

  • Layout builder
  • Layout Discovery
  • Paragraph Blocks

Steps to reproduce

  • Edit a layout builder page - /node/123/edit
  • Add a new paragraph.
  • Save page.
  • Then edit layout page - /node/123/layout
  • Click + Add Block
  • The issue is the β€œChoose a block” list does not show the block that was previously added.

You must β€œSave Layout” on /node/123/layout and before the paragraph will show in the β€œChoose a block” list.

Proposed resolution

NA

Remaining tasks

NA

User interface changes

NA

API changes

<

NA

Data model changes

NA

πŸ› Bug report
Status

Postponed: needs info

Version

4.0

Component

Code

Created by

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States dalemoore

    Seeing this too.

    If you add a paragraph, then view the node, the paragraph will be there. However, if you go into the Layout Builder, it won't be until you save and then reload Layout Builder.

    However, if instead you add a paragraph, go into Layout Builder, and revert to default WITHOUT saving, it will actually remove the paragraph you added to the node! So it actually causes data loss if you don't go to the Layout Builder and save immediately after adding a paragraph and decide later to revert to defaults.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Upgrading this to a major as I'm experiencing this too.

    Added 2 paragraph bundles
    Went into layout builder 0 appear
    Add to click save layout for any of them to show.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Wonder if there could be conflicts with the internal_dynamic_cache module of core?

  • Assigned to basvredeling
  • πŸ‡³πŸ‡±Netherlands basvredeling Amsterdam

    Yes, this is quite annoying. Thanks for the bug report. I'll have a look.

  • @basvredeling opened merge request.
  • @basvredeling opened merge request.
  • Status changed to Needs review over 1 year ago
  • πŸ‡³πŸ‡±Netherlands basvredeling Amsterdam

    @smustgrave @L.B. @dalemoore could you please test / review MR 6 in comment #8.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Sure!

    Has anyone figured out those the exact scenario this gets triggered? For me it's random.

  • πŸ‡³πŸ‡±Netherlands basvredeling Amsterdam

    @smustgrave as far as I can tell you should create a node with content moderation enabled. If you do you can pretty easily recreate the problem by adding a paragraph to that node that when that node has either: a) no published revisions at all or b) the latest published revision is not the latest revision.

  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    So the way I triggered it

    Installed internal_dynamic_cache
    Created a page with a pargraph block - in draft
    Saw the component in layout builder.
    Edited the page adding another component but saving as published
    In layout builder the new component is missing even with the patch.

  • πŸ‡³πŸ‡±Netherlands basvredeling Amsterdam

    I've merged MR 6 because it solves this issue on my end. And I have trouble reproducing this issue as described in #13. As far as I can tell, the alter hooks triggered in \Drupal\Core\Plugin\FilteredPluginManagerTrait::getFilteredDefinitions() are running correctly and this list is not cached in the LayoutPluginManager.

    @smustgrave Can you check if the route response is cached on your end? Try to bypass it by overriding the layout_builder.choose_block route and setting the no_cache: TRUE option.

  • πŸ‡³πŸ‡±Netherlands basvredeling Amsterdam

    Release 3.1.4 of the paragraph_blocks module contains the fixes in MR6. I'll keep this issue open for the time being for you all to report your findings. Hopefully this issue is fixed despite not dealing with the cache issues.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Tested again but still seeing the bug

    Create a page with a block, saving as draft
    Verified I see block

    Edited page adding a new block, saving as draft
    Verified I see both blocks

    Edited page adding a new block, saving as published
    Actually only see the first block now, not block 2+3

  • πŸ‡³πŸ‡±Netherlands basvredeling Amsterdam

    @smustgrave I believe the behaviour only occurs if the workflow has been configured incorrectly. Can you please check if the workflow is configured to apply to the content type in question?

    1. Go to /admin/config/workflow/workflows/manage/editorial (or the workflow your configuring.
    2. scroll to the This workflow applies to: section.
    3. check the content type (or other entity type) this workflow needs to apply to.

    If that fixes the problem on the latest dev release, we probably need to add this to the readme.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    No issue with the workflow

  • Status changed to Needs review over 1 year ago
  • πŸ‡³πŸ‡±Netherlands basvredeling Amsterdam

    @smustgrave I do believe this issue has been fixed in the latest commits in #19 / #20. Can you confirm?

  • Status changed to Fixed over 1 year ago
  • πŸ‡³πŸ‡±Netherlands basvredeling Amsterdam

    Moving these fixes to a release. I've tested use case #16 and was able to reproduce and fix it. Please re-open if issue resurfaces in a different use case.

    Thanks all for your contributions.

  • Status changed to Fixed over 1 year ago
  • πŸ‡³πŸ‡±Netherlands basvredeling Amsterdam
  • πŸ‡¨πŸ‡¦Canada peterhebert

    Using release 3.1.8 - issue still exists, I inspected the code, and confirm all of the code changes from this thread are present. I do not have Workflows module installed on the site. I cannot see new paragraphs as blocks in Layout Builder, until I save the layout as well. In addition, paragraphs that have been removed on the Edit form are still appearing in the list of available Paragraph blocks.

  • πŸ‡³πŸ‡±Netherlands basvredeling Amsterdam

    @peterhebert are you using some aggressive caching mechanism?

  • Status changed to Active over 1 year ago
  • πŸ‡³πŸ‡±Netherlands basvredeling Amsterdam

    Re-opened becaused this also resurfaced in 4.x

  • Status changed to Postponed: needs info over 1 year ago
  • πŸ‡³πŸ‡±Netherlands basvredeling Amsterdam

    not sure how to reproduce

  • I'm seeing this same issue. It appears that any paragraphs added after I initially use Layout to place blocks on a node aren't registered with the Paragraph Blocks module and aren't available to be placed from there on out.

  • Issue was unassigned.
  • πŸ‡³πŸ‡±Netherlands basvredeling Amsterdam
Production build 0.71.5 2024