File tree Expand file tree Collapse file tree
packages/react-dialog-async Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 "name" : " react-dialog-async" ,
33 "description" : " A promise-based way to show dialogs in React" ,
44 "type" : " module" ,
5- "version" : " 2.1.0 " ,
5+ "version" : " 2.1.1 " ,
66 "sideEffects" : false ,
77 "main" : " index.js" ,
88 "module" : " index.esm.js" ,
Original file line number Diff line number Diff line change @@ -96,6 +96,10 @@ const DialogProvider = ({
9696 const show = useCallback (
9797 ( id : string , data : unknown , unmountDelay ?: number ) : Promise < unknown > => {
9898 return new Promise ( ( resolve ) => {
99+ if ( unmountDelayTimeoutRefs . current [ id ] !== undefined ) {
100+ clearTimeout ( unmountDelayTimeoutRefs . current [ id ] ) ;
101+ }
102+
99103 setDialogState ( ( state ) => ( {
100104 ...state ,
101105 [ id ] : {
@@ -167,6 +171,7 @@ const DialogProvider = ({
167171 key = { id }
168172 open = { open }
169173 data = { data }
174+ mounted = { true } // Dialog is always mounted when it's being rendered
170175 handleClose = { ( value ) => {
171176 resolve ?.( value ) ;
172177 hide ( id ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import type { ComponentType } from 'react';
22
33export interface AsyncDialogProps < Request = void , Response = undefined > {
44 open : boolean ;
5+ mounted : boolean ;
56 handleClose : ( data ?: Response ) => void ;
67 data : Request ;
78}
You can’t perform that action at this time.
0 commit comments