[6.x] Reduce publish form and Live Preview overhead - #15251
Merged
Conversation
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>
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.
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.Valuesno longer clones the whole tree on every mutation.jsonDecodeValue,jsonEncodeValueandforgetValueeach cloned the entire values tree, mutated the copy and reassigned it;missingValuecloned it just to do a read-only walk. The constructor already clones, so the tree is private to the instance, andsetValuewas already mutating in place.