fix(web): prevent inputDialog cleanup from destroying chained dialogs#807
Open
AmitHaina wants to merge 1 commit into
Open
fix(web): prevent inputDialog cleanup from destroying chained dialogs#807AmitHaina wants to merge 1 commit into
AmitHaina wants to merge 1 commit into
Conversation
- Use closeTimeout ref to track the active closing transition timeout. - Clear closeTimeout and clean up previous form state on openDialog. - Replace promise-based delay in handleClose and onSubmit with a cancelable window.setTimeout.
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.
Fixes the issue where opening another inputDialog immediately after closing one results in a blank UI.
The Problem
When a dialog is closed (submitted or canceled), NUI sets a 200ms timeout to clean up the form state after the fade animation finishes. However, the client-side promise resolves immediately, meaning a script can trigger a new dialog before that 200ms is up. When this happens, the new fields are loaded, but the pending timeout from the first dialog still fires and clears them out.
The Fix
closeTimeoutref to keep track of the close animation timeout.handleCloseandonSubmitto use standardsetTimeoutwith the new ref instead of the promise-based wrapper.