Issue 2919092 breaks BC and causes issues for existing sites

Created on 11 August 2023, over 1 year ago
Updated 1 November 2023, about 1 year ago

Since updating to 2.0-beta6 from 2.0-beta4 my views loading on page load are very slow. There is a blank space where the view is suppose to be and when the view loads it is causing content reshuffling/flashing. Rolled back to beta4 and it's working as it should.

🐛 Bug report
Status

Fixed

Component

Code

Created by

🇬🇧United Kingdom danthorne Devon, UK

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

Comments & Activities

  • Issue created by @danthorne
  • 🇺🇸United States galactus86

    I also had a similar issue with the view no longer loading. But no flashing on our end.

    Note to downgrade we used composer require drupal/viewsreference:2.0.0-beta4

  • 🇮🇪Ireland frankdesign

    I am seeing the same issue. No flashing - the view simply doesn't load. Seems to be an issue with BigPipe as when the view doesn't load, there is an empty span in it's place with a class with a long name that includes bigpipe. It's also intermittent, which is a pain to try and find the source of the issue.

    Downgrading to beta4 resolves the issue.

  • 🇺🇸United States m-simmons

    Maybe related but mine seems a bit different. In a custom paragraph preprocess hook, I get this "Error: Attempt to assign property "section_anchor_id" on null", I think because they are now lazy loading the view. Oh well.

  • 🇬🇧United Kingdom rviner

    Same happens for me. Downgrading fixes the issue.

  • 🇳🇱Netherlands seanB Netherlands

    In 🐛 Viewsreference embeds Views without cache, breaking Dynamic page cache Fixed we introduced a lazy builder to solve issue related to caching. This inserts a div which should be replaced with the view when the page is loaded. I am not sure why the view fails to load in some cases, would you be able to debug this? I'd be happy to commit a fix.

  • 🇳🇱Netherlands ricovandevin

    I'm not sure about the "slow loading" part. But as for "no longer loading" and "big pipe" the following can be relevant. In 🐛 Viewsreference embeds Views without cache, breaking Dynamic page cache Fixed a lazy builder has been introduced to improve cacheability of pages with views references on it. This has landed in the 2.0.0-beta5 release. This means that from that release on indeed the output of the views reference field only contains a render placeholder.

    We have had an issue with this in a project where we checked in templates whether the view actually had "real" content.

    {% set rendered_content %}
      {{ content }}
    {% endset %}
    {% if rendered_content|striptags|trim %}
      {{ rendered_content }}
    {% endif %}
    

    Now that the views reference field only returns a placeholder (which is an empty HTML tag) the template does not render anything this way. We have been able to solve this by making the check in the template a little but smarter.

    {% set rendered_content %}
      {{ content }}
    {% endset %}
    {% if rendered_content|striptags|trim or 'drupal-render-placeholder' in rendered_content %}
      {{ rendered_content }}
    {% endif %}
    

    I'm not sure if we should really call this a bug in the Views Reference Field. But I will leave this issue open because I'm not sure whether this is the actual issue others ran into.

  • 🇳🇱Netherlands yustinTR

    @seanb in my project we check the content like this content.field_YOUR_PARAGRAPH[0]['contents']['#view'].result, but when i debug its breaks on the ['contents'] part because the lazy_load steps comes in front of it. Maybe this helps to fix the issue

  • 🇳🇱Netherlands seanB Netherlands

    Ah yes, the problem with checking the view content is that this makes caching the field a lot harder. You can still execute and render the view yourself. Or we could have an option on the formatter (maybe even a second formatter), that makes the use of the lazybuilder optional and preserve the old way of rendering.

  • 🇮🇹Italy finex

    Hi, I'm also experiencing this bug: with BigPipe enabled the view does not load.

  • 🇫🇷France freed_paris

    Similar issue when using beta6 version :

    AssertionError : When a #lazy_builder callback is specified, no properties can exist; all properties must be generated by the #lazy_builder callback. You specified the following properties: #context. dans assert() (ligne 337 de htdocs/web/core/lib/Drupal/Core/Render/Renderer.php).

    I downgraded to beta4 and it works again

    Fred

  • 🇧🇪Belgium RandalV

    I'm running into an issue with the beta5 and beta6 versions where an anonymous user will not see the view results. Logged in users do not get this issue.
    The view itself is being rendered (the exposed form and so on is there), but the results never are.

    I can't for the life of me figure out why. There are no console errors, and the #lazy_builder placeholder gets replaced properly as well.

    I'm also feeling forced to revert to beta4 to restore the functionality. If I do find a cause/solution, I'll post it here.

  • 🇬🇧United Kingdom jalpesh

    I am also running into the same issue where no view data getting load after updating module. I have used views_get_current_view() to fetch current view.

    Downgrading the module to composer require drupal/viewsreference:2.0.0-beta4 works fine.

  • Status changed to Closed: duplicate about 1 year ago
  • 🇬🇧United Kingdom scott_euser

    We have noticed if we apply the patch here BigPipe and GET requests start to play nice again: https://www.drupal.org/project/drupal/issues/3304746 🐛 Big pipe cannot handle (GET) form redirects (EnforcedResponseException) Needs work
    Hopefully that is helpful for anyone else coming across this issue.

    Would suggest we close this issue as the problem is in Core then and not here. Not quite sure the right 'closed' status here - I supposed its 'Closed (duplicate)' since the issue is raised in the core issue queue.

  • Status changed to Needs work about 1 year ago
  • 🇳🇱Netherlands seanB Netherlands

    I think 🐛 Viewsreference embeds Views without cache, breaking Dynamic page cache Fixed broke BC and a lot of custom code. For that reason the issue is probably valid. Renamed the title.
    I'm going to revert the changes in 🐛 Viewsreference embeds Views without cache, breaking Dynamic page cache Fixed and introduce the lazy builder option as a new formatter for people that want/need it.

  • Status changed to Needs review about 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    1 pass
  • 🇳🇱Netherlands seanB Netherlands

    Attached patch should work with the latest version. Could you please check if that fixes the issue?

  • 🇸🇪Sweden Kleve

    Also having the same problem with nothing rendered when logged in and BigPipe enabled.

    Patch from #16 adds a new layzy builder option to display the views. Tested with both display options. Nothing is rendered except the big-pipe-placeholder.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    1 pass
  • 🇳🇱Netherlands seanB Netherlands

    Sorry about that, some changes were missing in my previous patch (forgot to git add before creating it). Could you try this one?

  • 🇸🇪Sweden Kleve

    Tested patch from #18 with 2.0.0-beta6.

    With the old display format viewsreference the views are displayed for both logged in/anonymous users.
    If I switch to the new display format viewsreference (layzy builder) the views are displayed for anonymous but not for logged in users.

    Not sure if this is good or bad news :) But it looks like the patch works for existing sites using the old display format.

  • 🇳🇱Netherlands seanB Netherlands

    Thank you for testing! This at least solves the issues for the existing formatter currently broken in the latest release (for some sites). We can continue the development and debugging of the lazy builder in new issues. If someone else could also check and RTBC this I will try to commit this asap and create a new release.

  • Status changed to RTBC about 1 year ago
  • 🇺🇸United States kthull Fort Wayne, Indiana

    Also confirming #18 🐛 Issue 2919092 breaks BC and causes issues for existing sites Needs review fixed our logged in user missing views

    • seanB authored 7e23834d on 8.x-2.x
      Issue #3380691 by seanB, danthorne, Kleve, ricovandevin, yustinTR,...
  • Status changed to Fixed about 1 year ago
  • 🇳🇱Netherlands seanB Netherlands

    Thanks! Committed.

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

Production build 0.71.5 2024