fix(ui): guard live preview URL against aborted form-state requests in onSave - #17780
Open
waterWang wants to merge 1 commit into
Open
fix(ui): guard live preview URL against aborted form-state requests in onSave#17780waterWang wants to merge 1 commit into
waterWang wants to merge 1 commit into
Conversation
waterWang
requested review from
AlessioGr,
JarrodMFlesch and
jacobsfletch
as code owners
August 13, 2026 20:32
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.
Description
Fixes #17779
When a save starts while the previous form-state request is still in-flight, the earlier request is aborted and
getFormStateresolves to{ state: null }without alivePreviewURLkey. TheonSavecallback then destructuresundefinedlivePreviewURLand callssetLivePreviewURL(undefined), which silently closes the live preview pane while the user is still typing.The
onChangecallback already guards against this withif (!result) { return }— this PR applies the same protection toonSaveby only updating the live-preview / preview URLs when the form-state request actually succeeded (i.e.stateis present).Changes
packages/ui/src/views/Edit/index.tsx: only callsetLivePreviewURL/setPreviewURLwhenstateexists (aborted requests resolve to{ state: null })