From b7523fa99fb1852e9b78b02456d2af52e8bd6ac3 Mon Sep 17 00:00:00 2001 From: rico <25333032+trebeljahr@users.noreply.github.com> Date: Sun, 11 Dec 2022 13:06:20 +0100 Subject: [PATCH] Stop all AnimationActions on unmount/mixer change --- 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 }