@octanejs/motion 0.1.51 → 0.1.52

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/index.ts +14 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octanejs/motion",
3
- "version": "0.1.51",
3
+ "version": "0.1.52",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -60,7 +60,7 @@
60
60
  "react": "^19.2.7",
61
61
  "react-dom": "^19.2.7",
62
62
  "vitest": "^4.1.10",
63
- "octane": "0.2.0"
63
+ "octane": "0.2.3"
64
64
  },
65
65
  "scripts": {
66
66
  "test": "vitest run --root ../.. --project motion",
package/src/index.ts CHANGED
@@ -378,6 +378,19 @@ function createMotionComponent(tag: string, preloadedFeatures: boolean): MotionC
378
378
  if (isMotionValue(v) || isTransformKey(key)) styleMvDeps.push(key, v);
379
379
  }
380
380
  }
381
+ // The style inventory can grow or shrink; a hook dependency tuple cannot.
382
+ // Retain an equal inventory so ordinary renders do not churn subscriptions.
383
+ const previousStyleMvDeps: any[] | undefined = latest.styleMvDeps;
384
+ let sameMotionStyles = previousStyleMvDeps?.length === styleMvDeps.length;
385
+ if (sameMotionStyles) {
386
+ for (let i = 0; i < styleMvDeps.length; i++) {
387
+ if (!Object.is(previousStyleMvDeps![i], styleMvDeps[i])) {
388
+ sameMotionStyles = false;
389
+ break;
390
+ }
391
+ }
392
+ }
393
+ if (!sameMotionStyles) latest.styleMvDeps = styleMvDeps;
381
394
  useLayoutEffect(
382
395
  () => {
383
396
  // Clear only keys this effect previously managed that are absent from the
@@ -426,7 +439,7 @@ function createMotionComponent(tag: string, preloadedFeatures: boolean): MotionC
426
439
  for (const cleanup of cleanups) cleanup();
427
440
  };
428
441
  },
429
- styleMvDeps,
442
+ [latest.styleMvDeps],
430
443
  MV,
431
444
  );
432
445