@depup/lottie-react 3.1.0-depup.0 → 3.1.1-depup.0

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/README.md CHANGED
@@ -13,8 +13,8 @@ npm install @depup/lottie-react
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [lottie-react](https://www.npmjs.com/package/lottie-react) @ 3.1.0 |
17
- | Processed | 2026-08-17 |
16
+ | Original | [lottie-react](https://www.npmjs.com/package/lottie-react) @ 3.1.1 |
17
+ | Processed | 2026-08-27 |
18
18
  | Smoke test | passed |
19
19
  | Deps updated | 0 |
20
20
 
@@ -5,20 +5,25 @@
5
5
  * An element has a single `ref` slot, so any element that both this library and
6
6
  * the person using it want a handle on needs one callback that feeds both.
7
7
  *
8
- * Teardown is the part that is not boilerplate, because the two supported React
9
- * versions differ. React 19 treats a function returned from a ref callback as
10
- * its cleanup and then never calls that ref with `null`, while React 18
11
- * discards the return and calls with `null`. So each ref gets its own cleanup
12
- * where it returned one and a `null` call where it did not, and the combined
13
- * teardown is returned for React 19 to run. React 18 ignores it and calls this
14
- * callback with `null` instead, which does the same work.
8
+ * Teardown is where the two supported React versions differ. React 19 treats a
9
+ * function returned from a ref callback as its cleanup and never calls that ref
10
+ * with `null`; React 18 always calls with `null` and, in development, reports a
11
+ * returned function. So a combined teardown is returned only when a ref returned
12
+ * a cleanup of its own, since that ref must be torn down by it rather than by a
13
+ * `null` call. Otherwise nothing is returned and both versions call this
14
+ * callback with `null`, which clears every ref.
15
15
  */
16
16
  function mergeRefs(...refs) {
17
17
  return (node) => {
18
+ let returned = false;
18
19
  const teardowns = refs.map((ref) => {
19
20
  if (typeof ref === "function") {
20
21
  const cleanup = ref(node);
21
- return typeof cleanup === "function" ? cleanup : () => ref(null);
22
+ if (typeof cleanup === "function") {
23
+ returned = true;
24
+ return cleanup;
25
+ }
26
+ return () => ref(null);
22
27
  }
23
28
  if (ref) {
24
29
  ref.current = node;
@@ -28,6 +33,7 @@ function mergeRefs(...refs) {
28
33
  }
29
34
  return () => void 0;
30
35
  });
36
+ if (!returned) return;
31
37
  return () => {
32
38
  for (const teardown of teardowns) teardown();
33
39
  };
@@ -5,20 +5,25 @@
5
5
  * An element has a single `ref` slot, so any element that both this library and
6
6
  * the person using it want a handle on needs one callback that feeds both.
7
7
  *
8
- * Teardown is the part that is not boilerplate, because the two supported React
9
- * versions differ. React 19 treats a function returned from a ref callback as
10
- * its cleanup and then never calls that ref with `null`, while React 18
11
- * discards the return and calls with `null`. So each ref gets its own cleanup
12
- * where it returned one and a `null` call where it did not, and the combined
13
- * teardown is returned for React 19 to run. React 18 ignores it and calls this
14
- * callback with `null` instead, which does the same work.
8
+ * Teardown is where the two supported React versions differ. React 19 treats a
9
+ * function returned from a ref callback as its cleanup and never calls that ref
10
+ * with `null`; React 18 always calls with `null` and, in development, reports a
11
+ * returned function. So a combined teardown is returned only when a ref returned
12
+ * a cleanup of its own, since that ref must be torn down by it rather than by a
13
+ * `null` call. Otherwise nothing is returned and both versions call this
14
+ * callback with `null`, which clears every ref.
15
15
  */
16
16
  function mergeRefs(...refs) {
17
17
  return (node) => {
18
+ let returned = false;
18
19
  const teardowns = refs.map((ref) => {
19
20
  if (typeof ref === "function") {
20
21
  const cleanup = ref(node);
21
- return typeof cleanup === "function" ? cleanup : () => ref(null);
22
+ if (typeof cleanup === "function") {
23
+ returned = true;
24
+ return cleanup;
25
+ }
26
+ return () => ref(null);
22
27
  }
23
28
  if (ref) {
24
29
  ref.current = node;
@@ -28,6 +33,7 @@ function mergeRefs(...refs) {
28
33
  }
29
34
  return () => void 0;
30
35
  });
36
+ if (!returned) return;
31
37
  return () => {
32
38
  for (const teardown of teardowns) teardown();
33
39
  };
package/changes.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "bumped": {},
3
- "timestamp": "2026-08-17T00:14:39.892Z",
3
+ "timestamp": "2026-08-27T19:33:52.060Z",
4
4
  "totalUpdated": 0
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depup/lottie-react",
3
- "version": "3.1.0-depup.0",
3
+ "version": "3.1.1-depup.0",
4
4
  "description": "Lottie animations in React: one component for the easy path, the whole engine when you need control. (with updated dependencies)",
5
5
  "keywords": [
6
6
  "lottie-react",
@@ -174,8 +174,8 @@
174
174
  "changes": {},
175
175
  "depsUpdated": 0,
176
176
  "originalPackage": "lottie-react",
177
- "originalVersion": "3.1.0",
178
- "processedAt": "2026-08-17T00:14:54.679Z",
177
+ "originalVersion": "3.1.1",
178
+ "processedAt": "2026-08-27T19:34:01.227Z",
179
179
  "smokeTest": "passed"
180
180
  }
181
181
  }