Repository navigation
perf(core): a sidebar save ships the preview markup - #100
Merged
Merged
Conversation
8000
An edit cost two requests: the save, then, after a 500 ms quiet period,
GET /block/{id}/render (or /section/{id}/render) for the markup to swap in.
The save now renders the element it just wrote: BlockComponent dispatches
the internal cb:block:preview before cb:block:saved, and a section settings
save answers 200 {hotReload, html} instead of 204, relayed as
cb:section:preview. The builder swaps it in at once.
A type out of hot reload, or a render that throws, ships nothing: the save
still succeeds and the builder falls back to the render endpoint. Locally,
an edit now reaches the preview in ~150 ms instead of ~830 ms.
Klehm
force-pushed
the
perf/preview-markup-in-save
branch
from
December 2, 2026 10:51
28a4afa to
c9a4a7a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A sidebar edit cost two requests: the save, then, after a 500 ms quiet period,
GET /block/{id}/render(or/section/{id}/render) for the markup to swap into the preview. Every site using the builder paid a full extra request (kernel boot, session, firewall, Doctrine) and half a second per edit.What
BlockComponent::persistDraft()renders the block it just wrote (samerenderBlock()+RenderContext::forPreview()as the endpoint) and dispatches the internalcb:block:preview({blockId, html}) right beforecb:block:saved.200 {hotReload, html}instead of204; the form relays it ascb:section:preview.The public
cb:block:saved/cb:section:savedare unchanged: the markup rides on internal events so it never becomes contract.Fallbacks, unchanged
Measured (local, sandbox)
Tests
cb:section:saved.preview-markup-in-save.spec.js: one request per block or section edit, no/render, preview updated (fails on master).responsive-display.spec.jsnow checks the save succeeded rather than its exact 204.Docs:
docs/internals/frontend.md#the-save-carries-the-preview-markup.