From 16f1caf8f4789b6c6138ccaf80f61027df35b720 Mon Sep 17 00:00:00 2001 From: rico <25333032+trebeljahr@users.noreply.github.com> Date: Thu, 15 Dec 2022 06:21:19 +0100 Subject: [PATCH] fix: stop all AnimationActions on unmount/mixer change (#1176) --- src/core/useAnimations.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/useAnimations.tsx b/src/core/useAnimations.tsx index 2aa0adaca..c202516f5 100644 --- a/src/core/useAnimations.tsx +++ b/src/core/useAnimations.tsx @@ -49,5 +49,12 @@ export function useAnimations( }) } }, [clips]) + + React.useEffect(() => { + return () => { + mixer.stopAllAction() + } + }, [mixer]) + return api }