Summary
When a ReactModal is inside a Suspense component in React 18 and closeTimeoutMS is set, the modal will close when suspended, and not reopen afterwards, even if isOpen is still true.
Steps to reproduce
Open this codepen: https://codepen.io/MentalShirt/pen/vELvLyr?editors=0010
Expected behavior
- The modal is shown
- It then vanishes briefly while a "Loading" text is visible. The loading text is the fallback of the
Suspense component, which is shown because a component is loaded in lazily.
- It's then shown again as soon as it is unsuspended.
Actual behavior
- The modal is shown
- It then vanishes while a "Loading" text is visible.
- It stays closed even after the load is finished and the other components in the
Suspense unsuspend
Summary
When a
ReactModalis inside aSuspensecomponent in React 18 andcloseTimeoutMSis set, the modal will close when suspended, and not reopen afterwards, even ifisOpenis stilltrue.Steps to reproduce
Open this codepen: https://codepen.io/MentalShirt/pen/vELvLyr?editors=0010
Expected behavior
Suspensecomponent, which is shown because a component is loaded in lazily.Actual behavior
Suspenseunsuspend