From 61a75f71718ed8171041cc4f11ccc448c6d98ca7 Mon Sep 17 00:00:00 2001 From: Aliaksei Sapach Date: Mon, 20 Mar 2023 20:43:12 +0100 Subject: [PATCH] fix: perform sync update when exiting animation --- src/Transition.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Transition.js b/src/Transition.js index 41cd1f38..fe59bc12 100644 --- a/src/Transition.js +++ b/src/Transition.js @@ -291,8 +291,10 @@ class Transition extends React.Component { this.props.onExiting(maybeNode); this.onTransitionEnd(timeouts.exit, () => { - this.safeSetState({ status: EXITED }, () => { - this.props.onExited(maybeNode); + ReactDOM.flushSync(() => { + this.safeSetState({ status: EXITED }, () => { + this.props.onExited(maybeNode); + }); }); }); });