framer-motion 12.24.6 → 12.24.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -296,6 +296,10 @@ const AnimatePresence = ({ children, custom, initial = true, onExitComplete, pre
296
296
  * Track which exiting children have finished animating out.
297
297
  */
298
298
  const exitComplete = featureBundle.useConstant(() => new Map());
299
+ /**
300
+ * Track which components are currently processing exit to prevent duplicate processing.
301
+ */
302
+ const exitingComponents = React.useRef(new Set());
299
303
  /**
300
304
  * Save children to render as React state. To ensure this component is concurrent-safe,
301
305
  * we check for exiting children via an effect.
@@ -317,6 +321,7 @@ const AnimatePresence = ({ children, custom, initial = true, onExitComplete, pre
317
321
  }
318
322
  else {
319
323
  exitComplete.delete(key);
324
+ exitingComponents.current.delete(key);
320
325
  }
321
326
  }
322
327
  }, [renderedChildren, presentKeys.length, presentKeys.join("-")]);
@@ -368,6 +373,10 @@ const AnimatePresence = ({ children, custom, initial = true, onExitComplete, pre
368
373
  : presentChildren === renderedChildren ||
369
374
  presentKeys.includes(key);
370
375
  const onExit = () => {
376
+ if (exitingComponents.current.has(key)) {
377
+ return;
378
+ }
379
+ exitingComponents.current.add(key);
371
380
  if (exitComplete.has(key)) {
372
381
  exitComplete.set(key, true);
373
382
  }