Adding too many Views blocks to a Layout Builder page in Drupal 10.2 can break Ajax

Created on 3 April 2024, over 1 year ago

Problem/Motivation

I'm not sure if it's specific to our setup, but I don't think it is since we aren't hacking Layout Builder. We are using it mostly as it is provided by core. We do use these LB modules:
* Layout Builder Component Attributes
* Layout Builder Lock
* Layout Builder Operation Link
* Layout Builder Restrictions
* Layout Builder Restrictions by Region
* Layout Builder Styles
* Layout Builder Claro
* Layout Builder Iframe Modal

At first, we thought the error only happened when adding too many blocks of any kind. But, in further diving, it turns out the issue only happens when we add 5-7 Views blocks to a LB page. We can add 10+ non-Views blocks without issue, but as soon as we add 5-7 Views blocks, the issue arises again.

I think there is some performance bottleneck with the Layout Builder + Views blocks integration, that seemingly seems to have appeared in Drupal 10.2, because I have tested on 10.1 and the issue isn't present.

Steps to reproduce

Try adding 10 views blocks (from the Lists (Views) section of the LB blocks list onto a LB page.
At some point, you may encounter a JS error (in my case, I had 2 though).

iframe.js?sbcpjn:11 Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')
    at iframe.js?sbcpjn:11:23
    at iframe.js?sbcpjn:84:3

(This is specific to the Layout Builder Iframe Modal module we are using, but I think it's being caused by some other root cause)

An error occurred during the execution of the Ajax response: LoadJS

Proposed resolution

Not sure, make it so Views blocks aren't so heavy when integrated into Layout Builder. I assume these blocks are heavier than normal blocks, and maybe there's metadata or whatnot we can not include to bring minimize their footprint.

🐛 Bug report
Status

Active

Version

10.2

Component
Layout builder 

Last updated 42 minutes ago

Created by

🇺🇸United States joshua.boltz

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

Comments & Activities

  • Issue created by @joshua.boltz
  • Status changed to Postponed: needs info over 1 year ago
  • 🇳🇿New Zealand danielveza Brisbane, AU

    Thanks for the very detailed issue! As you mention your site is very specific with a lot on content with many extra LB modules enabled.

    That makes this quite difficult to trace down if this is an issue in core or somewhere else in your stack. It would be helpful if you were able to replicate this with just core. Maybe you could try use Devel & Devel generate to make a ton of content and try get this to trigger? I spent some time today trying this but had no luck.

    ResponseText:
    414 Request-URI Too Long
    Request-URI Too Long
    The requested URL's length exceeds the capacity
    limit for this server.

    It could potentially help if you could share the URL that was generated here?

  • 🇺🇸United States xjm
  • 🇫🇮Finland phonkala

    This comment might be completely unrelated, but I was just recently getting some LoadJS error when adding specifically Views blocks to my site. There was also lots other JS "undefined" errors whenever this happened. Also, this caused modules like Contextual Links & Layout Builder to stop working correctly and also there was something weird happening in the UI.

    My issue ended up being a missing tag in one Views block, I was using custom formatting for the output. This for some reason caused so so many issues on the site, including the JS errors and for some weird reason, also my Olivero sidebar was placed inside those tags (even though the Views blocks were in main content area), causing issues with the site theme and breaking many UI related modules.

    What I was thinking, maybe the "The requested URL's length exceeds the capacity limit for this server." you mentioned could be causing this too. If the server limits the request url length, you obviously aren't getting the response you expect, maybe that could cause similar issue I had.

    You might wanna try removing the blocks one by one and see if it's some specific one that is causing the issue. But anyways, just wanted to add a comment in case this would help figuring out the issue even a bit.

  • Status changed to Closed: cannot reproduce 8 days ago
  • 🇳🇿New Zealand danielveza Brisbane, AU

    Steps to replicate was asked for over a year ago in #8, I also tried to replicate the issue as part of that and could not.

    We've had no further responses & no other reports of the same issue discussed in the IS, so I'm closing this issue.

    Thanks for raising the issue! If anyone else has this or a similar issue, please feel free to open a new issue.

Production build 0.71.5 2024