pudui 0.0.2 → 0.0.3

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/dist/index.mjs +10 -5
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -754,6 +754,7 @@ function patchRenderNode(node, nextChild, context) {
754
754
  function patchArrayRenderNode(node, nextChildren, context) {
755
755
  const normalizedChildren = normalizeChildren(nextChildren);
756
756
  if (shouldPatchKeyedArray(node.c, normalizedChildren)) return patchKeyedArrayRenderNode(node, reuseKeyedArrayChildren(node, normalizedChildren), context);
757
+ if (patchSameLengthKeyedArrayRenderNode(node, normalizedChildren, context)) return node;
757
758
  const sharedLength = Math.min(node.c.length, normalizedChildren.length);
758
759
  for (let index = 0; index < sharedLength; index++) node.c[index] = patchRenderNode(node.c[index], normalizedChildren[index], context);
759
760
  const parent = node.e.parentNode;
@@ -806,13 +807,17 @@ function canReuseKeyedChild(previousChild, nextChild) {
806
807
  function shallowEqualProps(previousProps, nextProps) {
807
808
  if (previousProps === nextProps) return true;
808
809
  if (previousProps === void 0) return false;
809
- const previousKeys = Object.keys(previousProps);
810
- const nextKeys = Object.keys(nextProps);
811
- if (previousKeys.length !== nextKeys.length) return false;
812
810
  const previousRecord = previousProps;
813
811
  const nextRecord = nextProps;
814
- for (const key of previousKeys) if (previousRecord[key] !== nextRecord[key] || !Object.hasOwn(nextProps, key)) return false;
815
- return true;
812
+ let previousKeyCount = 0;
813
+ for (const key in previousRecord) {
814
+ if (!Object.hasOwn(previousRecord, key)) continue;
815
+ previousKeyCount++;
816
+ if (previousRecord[key] !== nextRecord[key] || !Object.hasOwn(nextProps, key)) return false;
817
+ }
818
+ let nextKeyCount = 0;
819
+ for (const key in nextRecord) if (Object.hasOwn(nextRecord, key)) nextKeyCount++;
820
+ return previousKeyCount === nextKeyCount;
816
821
  }
817
822
  function patchKeyedArrayRenderNode(node, normalizedChildren, context) {
818
823
  if (patchSameLengthKeyedArrayRenderNode(node, normalizedChildren, context)) return node;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pudui",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "A tiny JSX UI runtime built from the ground up.",
5
5
  "license": "MIT",
6
6
  "files": [