Skip to content

Commit

Permalink
fix(core): Fix our array returns (#3696)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock authored Oct 21, 2024
1 parent 38290e7 commit e452d6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/thin-cougars-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@urql/core': patch
---

Fix `deepMerge` regression on array values
8 changes: 3 additions & 5 deletions packages/core/src/utils/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ const deepMerge = (target: any, source: any): any => {
target = [...target];
for (let i = 0, l = source.length; i < l; i++)
target[i] = deepMerge(target[i], source[i]);

return target;
}
if (
!target.constructor ||
target.constructor === Object ||
Array.isArray(target)
) {
if (!target.constructor || target.constructor === Object) {
target = { ...target };
for (const key in source)
target[key] = deepMerge(target[key], source[key]);
Expand Down

0 comments on commit e452d6f

Please sign in to comment.