Skip to content

[6.x] Reduce publish form and Live Preview overhead - #15251

Merged
jasonvarga merged 2 commits into
6.xfrom
cp-publish-livepreview-perf
Aug 24, 2026
Merged

[6.x] Reduce publish form and Live Preview overhead#15251
jasonvarga merged 2 commits into
6.xfrom
cp-publish-livepreview-perf

Conversation

@jasonvarga

@jasonvarga jasonvarga commented Aug 24, 2026

Copy link
Copy Markdown
Member

Two independent performance fixes in the publish form, split out of #15158.

Live Preview only watches while it's open. The [payload, target] deep watcher was installed unconditionally at setup, so every publish form deep-watched its entire values tree on every keystroke whether or not Live Preview was ever opened. It's now installed when the preview is enabled, and torn down when it's disabled or the component unmounts — which also cancels any pending update and aborts an in-flight request. This is the bigger win and applies to every publish form in the CP.

Live Preview skips re-posting an unchanged payload. A deep change that serialises to the same payload we last posted no longer triggers another request. Explicit update() callers — open, popout, refresh — bypass this and always post. An example of when this happens is in the progressive mounting introduced by #15158.

Values no longer clones the whole tree on every mutation. jsonDecodeValue, jsonEncodeValue and forgetValue each cloned the entire values tree, mutated the copy and reassigned it; missingValue cloned it just to do a read-only walk. The constructor already clones, so the tree is private to the instance, and setValue was already mutating in place.

jasonvarga and others added 2 commits August 24, 2026 11:42
jsonDecodeValue, jsonEncodeValue and forgetValue each cloned the entire tree,
mutated the copy and reassigned it, and missingValue cloned it just to do a
read-only walk. The constructor already clones, so the tree is private to the
instance, and setValue was already mutating it in place.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The [payload, target] deep watcher was installed unconditionally, so every
publish form deep-watched its whole values tree whether or not Live Preview
was ever opened. It's now installed when the preview is enabled and torn down
when it's disabled or the component unmounts.

The watcher also skips posting a payload identical to the last one posted.
Explicit update() callers (open / popout / refresh) still always post.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jasonvarga
jasonvarga merged commit a3e28d0 into 6.x Aug 24, 2026
65 checks passed
@jasonvarga
jasonvarga deleted the cp-publish-livepreview-perf branch August 24, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant