@dcl/react-ecs 7.24.2-27638397160.commit-401ee50 → 7.24.2-27639923169.commit-aed4ecf

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.
@@ -15,12 +15,26 @@ export function propsChanged(component, prevProps, nextProps) {
15
15
  }
16
16
  }
17
17
  const changes = {};
18
+ // Iterate prevProps (this also catches removed keys, where nextProps[k] is undefined)...
18
19
  for (const k in prevProps) {
19
20
  const propKey = k;
20
21
  if (!isEqual(prevProps[propKey], nextProps[propKey])) {
21
22
  changes[propKey] = nextProps[propKey];
22
23
  }
23
24
  }
25
+ // ...then catch keys present only in nextProps (an optional prop set for the first time,
26
+ // e.g. an undefined value becoming defined). Iterating prevProps alone would drop these.
27
+ // Two allocation-free loops are used instead of a Set union to keep this hot path cheap.
28
+ // These keys aren't in prevProps, so emitting them whenever they're defined is both cheaper
29
+ // than (and avoids the falsy-value trap of) an isEqual(undefined, ...) comparison.
30
+ for (const k in nextProps) {
31
+ if (k in prevProps)
32
+ continue;
33
+ const propKey = k;
34
+ if (nextProps[propKey] !== undefined) {
35
+ changes[propKey] = nextProps[propKey];
36
+ }
37
+ }
24
38
  if (!Object.keys(changes).length) {
25
39
  return;
26
40
  }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dcl/react-ecs",
3
3
  "description": "Decentraland ECS",
4
- "version": "7.24.2-27638397160.commit-401ee50",
4
+ "version": "7.24.2-27639923169.commit-aed4ecf",
5
5
  "author": "DCL",
6
6
  "bugs": "https://github.com/decentraland/js-sdk-toolchain/issues",
7
7
  "dependencies": {
8
- "@dcl/ecs": "7.24.2-27638397160.commit-401ee50",
8
+ "@dcl/ecs": "7.24.2-27639923169.commit-aed4ecf",
9
9
  "react": "^18.2.0",
10
10
  "react-reconciler": "^0.29.0"
11
11
  },
@@ -40,5 +40,5 @@
40
40
  "tsconfig": "./tsconfig.json"
41
41
  },
42
42
  "types": "./dist/index.d.ts",
43
- "commit": "401ee505079894389381bf3a1cfc0e8ae97fe357"
43
+ "commit": "aed4ecf2b3b170d28dc5b68f38a7f84699aee0e9"
44
44
  }