Problem/Motivation
Split off from #2543334: Auto-placeholdering for #lazy_builder with bubbling of contexts and tags to make that one more easily reviewable. Details to follow.
Proposed resolution
Details to follow.
Remaining tasks
Details to follow.
User interface changes
None.
API changes
None.
Data model changes
None.
Why this should be an RC target
From #10:
Without this, max-age=0 blocks will not be placeholdered automatically, which means that any page with uncacheable blocks will not be able to use Dynamic Page Cache.
This would therefore IMO be a great RC target.
| Comment | File | Size | Author |
|---|---|---|---|
| #50 | 2559847-49.patch | 15.41 KB | ayalon |
| #48 | reroll_diff_2559847_46-48.txt | 14.93 KB | ankithashetty |
| #48 | 2559847-48.patch | 15.42 KB | ankithashetty |
| #44 | 2559847-44.patch | 15.13 KB | ayalon |
Comments
Comment #2
catchComment #3
catchComment #4
wim leersHere's a patch, directly extracted from #2543334-44: Auto-placeholdering for #lazy_builder with bubbling of contexts and tags.
Comment #5
wim leersComment #10
wim leersWithout this,
max-age=0blocks will not be placeholdered automatically, which means that any page with uncacheable blocks will not be able to use Dynamic Page Cache.This would therefore IMO be a great RC target.
But since it's a pure behavior change, and not an API change, it could also land in 8.1.0.
Comment #11
xjmComment #12
dawehnerGiven that this just touches one single class this could be easily implemented by a contrib module, right?
Comment #13
wim leersTest coverage is already included.
In theory this can be implemented in a contrib module until 8.1.x, yes. But virtually nobody will install such a module.
Without this, any block (or anything else) that has
max-age=0will cause the entire page to not be cached.It's totally fine to postpone this to 8.1.x, it would merely be unfortunate.
Comment #15
wim leersI got overzealous with enforcing simplicity here. This was possible initially, but then I also did this:
And it's
createCacheID()'s side effect that must work: it updates$elementsby reference when necessary. In the first iteration, thecreateCacheID()still lived in theset()call. Later, I then had to move thecreateCacheID()call intodoSet(), thus invalidating the code comment I quoted at the beginning.Comment #16
xjmComment #19
m4oliveiCame here from https://www.drupal.org/docs/8/api/render-api/auto-placeholdering.
I'm debugging an issue with a view. The view's cache setting is set to off, which from what I can tell sets the max-age to 0 for the views render array. However the whole page is still cached via the Page Cache (it does not appear to be cached in the Dynamic Page Cache). Is that due to this issue? I'm currently at 8.1.8.
Comment #20
berdirNope. You are looking for #2352009: Bubbling of elements' max-age to the page's headers and the page cache, you can see there about the challenges. See also http://drupal.stackexchange.com/questions/219568/stop-full-page-html-fro...
Comment #21
dawehnerComment #22
m4oliveiThanks @Berdir!
Comment #26
borisson_Patch no longer applies
Comment #27
savkaviktor16@gmail.com commentedRe-rolled
Comment #29
berdirCalls like this should apparently use isMethodCacheable() now.
Comment #30
MerryHamster commentedComment #31
MerryHamster commentedHere is an only reroll for 8.6.x-dev
Comment #32
MerryHamster commentedComment #39
neclimdulas noted by Berdir, the isMethodCacheable change. Haven't really reviewed the patch yet, wanted to see if this fixed all the failures first to set a baseline.
Found this in some documentation as an important upcoming change (in 8.6) and it _is_ marked major but is the summary still accurate? Seems like some people would be running into really annoying caching problems without it but there's no traction in a long time.
Comment #41
neclimdulThis should make it green. Just the old trusted callback changes for lazy builders.
Comment #42
neclimdulOk, so following back to the previous issue there's an epic comment by wim that kinda hints at what's going on here and I feel like I got the faintest hint of what's going on hear but I don't think I grok the impact of this rendering process well enough to get the interaction. I don't think the logic in arrays is helping any either.
That said, the fact that with the amount of testing we have in core at this point, nothing failing is a solid sign. I can also provide a bit of a code review:
Seem's like these provider datasets could use useful keys.
The comment doesn't seem helpful as an assertion and is incomplete. This should assert the constant.
Unfortunately this was kind-of a distraction so I might not come around to reviewing this further for a while but it looks like a cool problem with some interesting performance implications so interest peaked :-D
Comment #44
ayalon commentedReroll for 9.2.2
Comment #46
ayalon commentedReroll for 9.3.2
Comment #47
ayalon commentedReroll for 9.3.2
Comment #48
ankithashettyUpdated the rerolled patch, also fixed the phpcs errors observed during the checks run locally (using
sh ./core/scripts/dev/commit-code-check.sh).Thanks!
Comment #50
ayalon commentedI forgot to rename a function call that leads to fatal. Fixed now.
Comment #54
sinn commentedNot sure it is relevant anymore. Based on my tests blocks with max-age = 0 are placeholdered in Drupal 9.5 and can use Dynamic page cache. Or we need to add test to show the use case of the issue.
Comment #55
rosk0NT based on #54.