Skip to content

fix(web): prevent inputDialog cleanup from destroying chained dialogs#807

Merged
thelindat merged 1 commit into
overextended:mainfrom
AmitHaina:main
Jul 13, 2026
Merged

fix(web): prevent inputDialog cleanup from destroying chained dialogs#807
thelindat merged 1 commit into
overextended:mainfrom
AmitHaina:main

Conversation

@AmitHaina

Copy link
Copy Markdown
Contributor

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

  • Added a closeTimeout ref to keep track of the close animation timeout.
  • If a new dialog is opened while a close timeout is pending, we clear the timeout and immediately reset the form state before populating the new data.
  • Refactored handleClose and onSubmit to use standard setTimeout with the new ref instead of the promise-based wrapper.

- 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.
@thelindat thelindat merged commit 5f52c5e into overextended:main Jul 13, 2026
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.

2 participants