Block access is checked even if the block's region is never rendered

Created on 13 July 2023, over 1 year ago

Problem/Motivation

BlockPageVariant::build() calls BlockRepository::getVisibleBlocksPerRegion() and this method calls the access function of every block in each region, even if a region is never used in the page.

Steps to reproduce

  1. Create a block that has slow access function or one that returns a short max-age.
  2. Place this block in a region without any condition.
  3. Don't render this region in page.html.twig.
  4. The cache parameters from the block access result bubble to the page, even if the region is not displayed.

We noticed this because it creates problems with the blockgroup module (because it implements block groups as regions): πŸ› Block access is checked even if block is inside a group that is not displayed Active

Proposed resolution

I guess instead of checking every block access upfront, they could be checked lazily when their parent region is rendered.

πŸ› Bug report
Status

Active

Version

10.1 ✨

Component
BlockΒ  β†’

Last updated 1 day ago

Created by

πŸ‡«πŸ‡·France prudloff Lille

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

Comments & Activities

Production build 0.71.5 2024