Apply brand kit colour changes optimistically
Overview
Every brand kit colour write blocks on the network before anything visible changes. Saving an edit awaits the PATCH, and only when that resolves does the resulting tag invalidation refetch the brand kit and repaint the row — two serialised round trips, with the form held open on a spinner throughout.
To reproduce: open the brand kit panel, edit a color, and save. The swatch and the form both wait for the server.
Three related defects sit in the same path. Color mutations invalidate only the BrandKits tags, but useBrandKitColors prefers the auto-save draft's colors, so while a brand kit draft exists (any prior font edit creates one) a color write is not reflected at all. The page preview receives brand kit colors as a server-rendered stylesheet and only re-requests it on a full editor load, so a color change never reaches the preview while the editor stays open. And creating a color cannot be applied early at all, because the server mints the UUID.
Proposed Resolution
Apply color writes to the query cache before the request is sent, and undo that patch when the server rejects it, so the editor never keeps showing a value that was not stored. Patch both cache entries the colors UI reads, and invalidate the auto-save entry as well so it is reconciled rather than left holding a stale or optimistic value.
Two hazards specific to this pattern need handling. Each patch must mutate a single color in place, so its inverse cannot revert a concurrent edit to a different color. And each write must record a token per color id and roll back only while it is still the newest, so a slow failing request cannot resurrect a value the author has already moved away from.
Let the client mint the color UUID so a new color can be listed under the identifier it will keep, rather than a placeholder that the row's edit, rename, and delete actions would send to the server. Inject the current colors into the page preview as CSS custom properties, re-applied when a preview finishes loading.