Repository navigation
Conversation
🦋 Changeset detectedLatest commit: ff68d5e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@chungyo is attempting to deploy a commit to the Toss Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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
Reopening a closed overlay with the same
overlayIdcurrently leaves the newopenAsyncpromise pending. For example,openAsync → close('first') → openAsync → close('second')resolves only the first call, even though the second overlay closes.This happens because reopening deliberately retains the original controller and component key to preserve component state, including the controller wrapper that captured the first promise. This change keeps that state-preserving behavior and supplies the result callbacks belonging to each new invocation.
Changes
rejectwhen reopened synchronously.Motivation and Context
The FAQ documents
closeas retaining state for reuse, whereasunmountresets it. Requiring an unmount betweenopenAsynccalls would resolve the promise problem by discarding the very state thatcloseis meant to retain.How Has This Been Tested?
open/openAsynccalls, ID/context isolation, and unmount/reset behavior. A separatetsc --noEmitcheck passes. The full tests, typecheck, and package build also pass on the repository-pinned Node 22.20.0 with Yarn 4.5.1.attw --pack,publint, and the React 16/17/18/19 example builds pass.actwarnings both before and after this change; the added regression file does not add warnings.Types of changes
Checklist
The existing FAQ already describes the intended state preservation; no documentation or downstream dependency change is required.
Further Comments
This does not settle promises closed externally with
overlay.close/unmount; that is the separate behavior addressed by #215. The implementation touches some of the same files, so merging both changes will require an integration check. Animation-frame scheduling and overlay ordering are unchanged.The public
open/openAsyncsignatures and return types are preserved, as are the props supplied to each original controller kind.useOverlayDataexposes the additional optionalasyncResultandisAsyncControllerfields stored on the item. Reusing an ID still retains the original controller, so callers must keep that controller's result contract consistent; replacing the controller or changing its result type is outside this fix.