Repository navigation
Render prepared widget HTML inside the layout and prepare it before the public guard - #863
Conversation
|
Parked (draft). Review found two P1 issues with falling back to the layout path: hydrated widgets' prepared HTML is not carried into the layout render (content loss on no-master layouts using prepared sections), and the fallback can query inside the public view guard (lazy fragment version lookups). A correct fix renders prepared HTML per widget inside the layout path and prepares fragment references before the guard; that is cross-repository design work, deferred past this release. The Agency trigger is fixed in the App by scoping the marketing payload contributor and resource policy to the marketing master. |
… the guard Partly hydrated graphs now render through the layout with each widget's prepared section HTML, looked up by container, widget and occurrence, and fall back to the normal widget renderer only where none was prepared. An optional PublicLayoutRenderPreparer runs before the public query guard so layout renderers can load what they need up front. Fully hydrated and fully unhydrated output is unchanged.
Passing the render data to the layout component as an attribute handed the object to existing anonymous theme layouts that do not declare it, which broke $attributes->merge(). The renderer now sets a PublicRenderDataScope around the guarded render, restoring the previous value on exit, and layout views read it from there.
A container binding would add a surface to every package's installed-runtime baseline. The scope is now static with the same set-and-restore around each render, so no state outlives a render.
|
Merge evidence. Hosted CI is green on 7bbbb69: all 28 jobs passed, including the full
|
Problem
BladeFrontendResponseRendererused the hydrated layout-graph shortcut as soon as any widget carried prepared section HTML, so<x-capell::layout/>never ran. On layouts without an authored master file, public pages lost their container presentation (e.g.meta.html_class) and every widget that was not pre-rendered. Reproduced on a fresh App install: the free Agency theme rendered without itsppc-shellcontainer and 12 of 13 widgets; Core's default layout lost its sidebar container and widgets. Any content-sections or contributor that hydrates one widget triggers it.Change
The shortcut is taken only when every graph widget has non-empty section HTML and no container carries presentation metadata; otherwise the normal layout renderer runs. Fully hydrated graphs (e.g. the demo kit) keep identical output. The authored-master guard (#847) and master-file path are unchanged.
Tests
BladeFrontendResponseRendererTest: mixed hydrated/unhydrated layout keeps container class and all widgets; container metadata forces the layout path; fully hydrated graph keeps the shortcut and section order; neutral demo-kit metadata stays shortcut-compatible; unsafe fallback hook output rejected. Six fail on main, all 24 pass here.Not verified
packages/frontendrun: 2RequiredChildCommandsTesterrors reproduce on the original renderer (SQLitesettingstable re-create); 2 stylesheet assertions failed only in the broad local run and pass in isolation. Hosted matrix is the gate.