fix(overlay): prevent orphaned DOM elements during dismiss by removing setState to stop race conditions

This commit is contained in:
ShaneK
2025-04-08 09:33:17 -07:00
parent 835ad52c29
commit 17ebd1b2f7

View File

@@ -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);