Follow-up to #2450993: Rendered Cache Metadata created during the main controller request gets lost
Problem/Motivation
Code needs to use:
if (!$render_context->isEmpty()) {
BubbleableMetadata::createFromRenderArray($form)
->merge($render_context->pop())
->applyTo($form);
}
But while isEmpty() feels right, the pop() and writing all that boiler plate feels wrong.
Proposed resolution
if (!$render_context->isEmpty()) {
$render_context->applyTo($form);
}
Remaining tasks
- Do it
User interface changes
- None
API changes
API addition:
- Add RenderContext::applyTo method
Data model changes
- None
BETA EVAL PROTO:
Prioritized, because this API problem was missed during resolving a critical issue. Hence => API completion.
Comments
Comment #1
wim leersIt's a pure API addition for extremely rare cases, so I don't think this is entirely truthful.
Agreed with "normal" priority.
Comment #2
dawehnerNice!
Comment #16
smustgrave commentedThank you for creating this issue to improve Drupal.
We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #17
smustgrave commentedThis code is still there so wanted to follow up if still valid task all these years later?