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 b6e6d7650e..664e1f6584 100644 --- a/packages/framer-motion/src/motion/utils/use-visual-element.ts +++ b/packages/framer-motion/src/motion/utils/use-visual-element.ts @@ -72,9 +72,14 @@ export function useVisualElement( ) } + const isMounted = useRef(false) useInsertionEffect(() => { - if (visualElement && visualElement.current) { - visualElement && visualElement.update(props, presenceContext) + /** + * Check the component has already mounted before calling + * `update` unnecessarily. This ensures we skip the initial update. + */ + if (visualElement && isMounted.current) { + visualElement.update(props, presenceContext) } }) @@ -93,6 +98,7 @@ export function useVisualElement( useIsomorphicLayoutEffect(() => { if (!visualElement) return + isMounted.current = true window.MotionIsMounted = true visualElement.updateFeatures()