Skip to content

Commit 17ebd1b

Browse files
committed
fix(overlay): prevent orphaned DOM elements during dismiss by removing setState to stop race conditions
1 parent 835ad52 commit 17ebd1b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/react/src/components/createInlineOverlayComponent.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,10 @@ export const createInlineOverlayComponent = <PropType, ElementType>(
199199
* that removes the item.)
200200
*/
201201
if (wrapper && el) {
202+
// The delegate's removeViewFromDom call handles unmounting the React component.
203+
// Setting state here can cause race conditions.
204+
// Restore the wrapper to the element before the delegate removes it.
202205
el.append(wrapper);
203-
this.setState({ isOpen: false });
204206
}
205207

206208
this.props.onDidDismiss && this.props.onDidDismiss(evt);

0 commit comments

Comments
 (0)