- Issue created by @alexpott
- π¬π§United Kingdom alexpott πͺπΊπ
Here's a decent blog post on the subject - https://drupalsun.com/brian/2020/12/20/how-drupals-dynamic-page-cache-de...
- π¬π§United Kingdom catch
Opened π Block status code visibility condition should use a status code cache context Active to core, but just that issue would require sites to configure the breadcrumb block not to show on 404 pages.
However once the cache context is there, it might be possible to check for a 404/403 first, early return there while adding the status code cache context, then only add the url cache context if it gets past that. Or set the breadcrumb builder not to apply on 404 pages at all.
- πΊπΈUnited States Greg Boggs Portland Oregon
I had noticed this problem on my own Drupal website, and didn't realize it was easy breadcrumb module doing it.
This cache improvement sounds fantastic. Hiding breadcrumbs on 404 also sounds good. If y'all want to just look over the cache code and make sure it's correct that would be ideal. The cache code is grouped in the module here:
https://git.drupalcode.org/project/easy_breadcrumb/-/blob/2.x/src/EasyBr...
I think this is an unrelated cache issue:
https://www.drupal.org/project/easy_breadcrumb/issues/3500483 π Cache issue after Drupal 10.4 upgrade Active - π¬π§United Kingdom catch
So π Block status code visibility condition should use a status code cache context Active will make the performance issue fixable with the status code block condition.
But I think it would be good to fix this directly in easy breadcrumb too - it can look for the exception on the request (see code in that issue), and if it's there, early return and only add the status code cache context instead of the URL one - probably best to do in the ::applies() method? Not familiar with the code so take with a pinch of salt but should be enough to get started. Only problem is that cache context will be in 11.2, maybe 10.5, but not a patch release, so either needs to wait or maybe copy it for a while.
- πΊπΈUnited States Greg Boggs Portland Oregon
Makes sense. I'll see what I can do. That code is pretty messy at this point after many years of small public contributions.