Skip to content

Commit e1d6c9a

Browse files
committed
fix: removeChild may throw
1 parent 29b2b9d commit e1d6c9a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

client/overlay/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,12 @@ function render() {
240240
*/
241241
function cleanup() {
242242
// Clean up and reset all internal state.
243-
document.body.removeChild(iframeRoot);
243+
try {
244+
document.body.removeChild(iframeRoot);
245+
} catch (e) {
246+
// In case user render react app directly to body, will trigger `NotFoundError`
247+
// https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild#exceptions
248+
}
244249
scheduledRenderFn = null;
245250
root = null;
246251
iframeRoot = null;

0 commit comments

Comments
 (0)