Skip to content

Commit

Permalink
fix #1973 array over object reconcile
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansolid committed Jan 3, 2024
1 parent 40b5d78 commit b887587
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/weak-wombats-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"solid-js": patch
---

fix #1973 array over object reconcile
8 changes: 6 additions & 2 deletions packages/solid/store/src/modifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@ function applyState(
) {
const previous = parent[property];
if (target === previous) return;
const isArray = Array.isArray(target);
if (
property !== $ROOT &&
(!isWrappable(target) || !isWrappable(previous) || (key && target[key] !== previous[key]))
(!isWrappable(target) ||
!isWrappable(previous) ||
(isArray && !Array.isArray(previous)) ||
(key && target[key] !== previous[key]))
) {
setProperty(parent, property, target);
return;
}

if (Array.isArray(target)) {
if (isArray) {
if (
target.length &&
previous.length &&
Expand Down

0 comments on commit b887587

Please sign in to comment.