From af1964f9ac6a70bcd42465e0753fb7113385af80 Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Sat, 5 Aug 2023 09:59:43 +0200 Subject: [PATCH] Fix the bug where react would complain if SnapshotEditor is unmounted --- packages/r3f/src/extension/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/r3f/src/extension/index.ts b/packages/r3f/src/extension/index.ts index 6e9839a..d28e1b5 100644 --- a/packages/r3f/src/extension/index.ts +++ b/packages/r3f/src/extension/index.ts @@ -150,7 +150,10 @@ const r3fExtension: IExtension = { root.render(React.createElement(SnapshotEditor, {paneId})) function unmount() { - root.unmount() + // gotta unmount in the next tick, otherwise react will complain https://github.com/facebook/react/issues/25675 + setTimeout(() => { + root.unmount() + }, 0) } return unmount },