Problem/Motivation
This blocks BigPipe for Drupal 8.
#2478483: Introduce placeholders (#lazy_builder) to replace #post_render_cache introduced Renderer::renderPlaceholder(). But kept it protected and off the interface.
First it was public (and on the interface). But then we decided against it, because #2478483-76: Introduce placeholders (#lazy_builder) to replace #post_render_cache:
@Fabianx remarked that the way
Renderer::renderPlaceholder()is currently implemented makes it impossible to be used by the BigPipe render strategy, because BigPipe will not be able to merge the bubbleable metadata from the rendered placeholder with that of the rest of the HTML (which makes total sense) — it will e.g. have to load additional assets by including some JS to load those additional assets without loading the already-loaded assets again (i.e. something likeDrupal.loadAssetLibrary(), which takesdrupalSettings.ajaxPageStateinto account).But! That's not something we need to solve here. We can just keep that method protected for now, and make it public (and a public API) as part of #2469431: BigPipe for auth users: first send+render the cheap parts of the page, then the expensive parts. That helps keep the scope of this issue well-defined.
Guess what. #2469431: BigPipe for auth users: first send+render the cheap parts of the page, then the expensive parts is now at that point :) It is in fact blocked on this.
Proposed resolution
- Make
Renderer::renderPlaceholder()public - Add
RendererInterface::renderPlaceholder()
Note this already has extensive test coverage in \Drupal\Tests\Core\Render\RendererPlaceholdersTest.
Remaining tasks
Review.
User interface changes
None.
API changes
None.
Only an API addition: RendererInterface::renderPlaceholder().
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | make-2603786-9-required.patch | 2.72 KB | joelpittet |
| #9 | make-2603786-9-other-see.patch | 3.62 KB | joelpittet |
| #9 | interdiff-other-see.txt | 2.19 KB | joelpittet |
| #9 | interdiff-required.txt | 1.16 KB | joelpittet |
| #2 | 2603786-2.patch | 2.65 KB | wim leers |
Comments
Comment #2
wim leersComment #3
wim leersComment #4
wim leersComment #5
fabianx commentedRTBC - Looks great to me!
Comment #6
xjmSo by adding the method to the interface, this is technically a BC break for anyone creating their own implementation of the entire render system... which would be amazing. Ahem. So @alexpott, @effulgentsia, @catch, and I agreed with making this an rc target.
Comment #7
xjmNote that this format for @see does not work with api.d.o and our standards require a fully namespaced class/method. See:
Comment #8
joelpittetFixing #7
Comment #9
joelpittetThis was RTBC, I've addressed the concern in #7 also have two patches. One with the fixes to the other @see :: issues and one withonly the required changed hunks mentioned in #7 Pick one;)
Comment #10
alexpottCommitted 2f5bf09 and pushed to 8.0.x. Thanks!
Comment #12
xjmThanks @joelpittet for fixing that up!
Comment #13
wim leersJep, @joelpittet++ :)