Repository navigation
v0.8.0
Agents can change one page builder block without resending the page.
Added
Set-scoped writes. entries_update, terms_update, and globals_update take a Replicator or Grid field as an object keyed by set id, the id Statamic stores on every set and row, and merge into just those sets. {"page_builder": {"wKJQXf2s": {"variant": "centered"}}} changes one field of one block, and the page is saved the way the Control Panel saves it, so the other blocks keep their content, including blocks someone edited in the Control Panel in between. A tweak costs 6 to 11 times fewer bytes than fetching and resending the whole field. null removes a set, a Replicator or Grid nested in a set merges by id the same way, and an unknown id is an error that lists the existing sets with their types. A list still replaces the field, which is how sets are added, reordered, or given another type. Validation errors name a set by its id, as in page_builder.wKJQXf2s.heading.
One set at a time from entries_get and terms_get. fields takes handle.<id> and returns that set of a Replicator or Grid field as an object keyed by its id. That is the shape the update tools merge, so sending it back can never drop a sibling block.
Changed
Large page builders are read as an index. entries_get and terms_get return a Replicator field over 4 KB of JSON as an index of its sets, each with id, type, enabled when it is off, and a short preview from its title or first text field, under the same __preview marker as a long Bard value. Sending the index back is refused, and the error names the by-id patch. fields: ["page_builder"] fetches the whole field as before. Grid fields stay inline whatever their size. An agent that used to fetch a long page builder and send it back whole now gets the index and one error that points at the cheaper path.
Worth knowing
What a by-id write validates. Only what you send is checked for unknown keys, and a set fetched by id can go back whole, a key its blueprint no longer defines included, as long as that key is unchanged. The page then passes the same validation as a Control Panel save, so a block that no longer satisfies its rules blocks the write and is named by id in the error. Inside a set the merge is shallow: each named field is replaced whole, a Group included, and enabled must be true or false. null clears a page builder; an empty list or object is refused, since PHP cannot tell {} from [].
What it can't address. Bard sets keep their place inside the Bard value. A blank id, the id 0, or one that several sets share is an error that points at the whole field. A global set without a blueprint refuses the object form, since nothing says which variable holds sets.
Full changelog: v0.7.2...v0.8.0