mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(overlay): prevent orphaned DOM elements during dismiss by removing setState to stop race conditions
This commit is contained in:
@@ -199,8 +199,10 @@ export const createInlineOverlayComponent = <PropType, ElementType>(
|
||||
* that removes the item.)
|
||||
*/
|
||||
if (wrapper && el) {
|
||||
// The delegate's removeViewFromDom call handles unmounting the React component.
|
||||
// Setting state here can cause race conditions.
|
||||
// Restore the wrapper to the element before the delegate removes it.
|
||||
el.append(wrapper);
|
||||
this.setState({ isOpen: false });
|
||||
}
|
||||
|
||||
this.props.onDidDismiss && this.props.onDidDismiss(evt);
|
||||
|
||||
Reference in New Issue
Block a user