From 1e7f9df3c81d214a977a796d182e18c47d4c7e81 Mon Sep 17 00:00:00 2001 From: Matt Perry Date: Thu, 31 Oct 2024 10:48:46 +0100 Subject: [PATCH] Fix double .update() call on mount --- packages/framer-motion/src/motion/utils/use-visual-element.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/framer-motion/src/motion/utils/use-visual-element.ts b/packages/framer-motion/src/motion/utils/use-visual-element.ts index 9c46c31ad0..b6e6d7650e 100644 --- a/packages/framer-motion/src/motion/utils/use-visual-element.ts +++ b/packages/framer-motion/src/motion/utils/use-visual-element.ts @@ -73,7 +73,9 @@ export function useVisualElement( } useInsertionEffect(() => { - visualElement && visualElement.update(props, presenceContext) + if (visualElement && visualElement.current) { + visualElement && visualElement.update(props, presenceContext) + } }) /**