Fix modal opening race condition

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>

React 17 is hitting a race condition when a modal is closing and is trying to open another one within the same tick.
A proper long term fix would be using React.createPortal to avoid manually mounting and unmounting new React roots
pull/21833/head
Germain Souquet 2021-06-22 09:53:58 +01:00
parent 9fa7ac21bd
commit 3c72569270
1 changed files with 1 additions and 1 deletions

View File

@ -385,7 +385,7 @@ export class ModalManager {
</div>
);
ReactDOM.render(dialog, ModalManager.getOrCreateContainer());
setImmediate(() => ReactDOM.render(dialog, ModalManager.getOrCreateContainer()));
} else {
// This is safe to call repeatedly if we happen to do that
ReactDOM.unmountComponentAtNode(ModalManager.getOrCreateContainer());