From 3865525522baeb2f917c301c45c25a3f44e353b8 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Wed, 15 Jul 2020 14:19:36 +0200 Subject: [PATCH] fix(unmount): Flush cleanup functions syncronously --- src/pure.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pure.js b/src/pure.js index be0fa3f1..f2f3438f 100644 --- a/src/pure.js +++ b/src/pure.js @@ -74,7 +74,11 @@ function render( el.forEach(e => console.log(prettyDOM(e, maxLength, options))) : // eslint-disable-next-line no-console, console.log(prettyDOM(el, maxLength, options)), - unmount: () => ReactDOM.unmountComponentAtNode(container), + unmount: () => { + act(() => { + ReactDOM.unmountComponentAtNode(container) + }) + }, rerender: rerenderUi => { render(wrapUiIfNeeded(rerenderUi), {container, baseElement}) // Intentionally do not return anything to avoid unnecessarily complicating the API.