- πͺπΈSpain javier_rey
Hi! I think there is a bug in the patch, as it is defined, in line 163, the variable "$render_array" is overwritten, losing the title of the view.
if ($plugin_types) { // Add a custom template if the title is available. $title = $view->getTitle(); if (!empty($title)) { // If the title contains tokens, we need to render the view to // populate the rowTokens. if (strpos($title, '{{') !== FALSE) { $view->render(); $title = $view->getTitle(); } $render_array['title'] = [ '#theme' => 'viewsreference__view_title', '#title' => $title, ]; } } $render_array = $view->buildRenderable($display_id, $view->args, FALSE);
Also, when we return an empty array and we have the "Internal Page Cache" module enabled, the page cache is not being refreshed.
- Create a view block that lists basic pages with the "tag based" option.
- Insert the block as a field inside another type of content, such as a landing page.
- Open the landing page as anonymous and as a registered user.
- Create a basic page and reload the landing page as anonymous and as a registered user.
I've added a patch which imo fixes these two cases. I am not an expert, so if there are any problems any help is welcome.
-
seanB β
committed c04b4c3c on 8.x-2.x authored by
artem_sylchuk β
Issue #2919092: Viewsreference embeds Views without cache, breaking...
-
seanB β
committed c04b4c3c on 8.x-2.x authored by
artem_sylchuk β
- Status changed to Fixed
almost 2 years ago 6:22pm 20 March 2023 - π³π±Netherlands seanB Netherlands
Merged the PR with the latest changes from [#26]. Thanks everyone!
Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
about 1 year ago 1:55pm 5 October 2023 - π³π±Netherlands wilfred waltman
This lazy-loading solution messes up one of our javascript because the js runs before the content of the blok is loaded now. I don't know if this solution should be reverted or be made configurable but for know I am going to revert that commit in our project.
A patch is attached for anyone else experiencing the same issue.
- πΊπ¦Ukraine artem_sylchuk Lutsk
BigPipe triggers Drupal Behaviors after inserting the HTML, you need to properly use behaviors with the proper context variable usage in your JS: https://www.drupal.org/docs/drupal-apis/javascript-api/javascript-api-ov... β
Also there is an issue with bigpipe itself after switching to the MutationObserver API: π Large placeholders are not processed RTBC - πΊπΈUnited States nsciacca
Thanks @Wilfred Waltman - patch helped me when the View failed to display to logged in users.
- π«π·France dark05
Hello :-) With the version 2.0.0-beta7 any patch works. I'm created my custom patch.
- πΊπΈUnited States ddavisboxleitner
On version 8.x-2.0-beta7 of the module, this change is introduced as a separate field formatter:
https://git.drupalcode.org/project/viewsreference/-/blob/8.x-2.0-beta7/s...
To enable it (and potentially resolve the issues mentioned in the ticket) you have to select 'Views reference (lazy builder)' as the format for your Views Reference field under Manage Display.