Skip to content

Commit

Permalink
fix: add deepMergeReplaceArrays for controls
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Jul 10, 2020
1 parent ddceb8c commit 74c4a3b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion core/core/src/deepMerge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@ const mergeArrays = (dest: any[], src: any[]) => {
export const deepMergeArrays = (a: any, b: any) =>
merge(a, b, { arrayMerge: mergeArrays });

export { merge };
export const deepMergeReplaceArrays = (a: any, b: any) =>
merge(a, b, {
arrayMerge: (dest: any[], src: any[]) => src,
});

export { deepMergeReplaceArrays as merge };
4 changes: 2 additions & 2 deletions core/store/src/serialization/transform-controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
ComponentControl,
ControlTypes,
Story,
deepMerge,
deepMergeReplaceArrays,
Document,
StoryComponents,
getComponentName,
Expand Down Expand Up @@ -88,7 +88,7 @@ export const transformControls = (
return true;
})
.reduce((acc, key) => ({ ...acc, [key]: newControls[key] }), {});
return deepMerge(filteredControls, controls || {});
return deepMergeReplaceArrays(filteredControls, controls || {});
}
}
return controls;
Expand Down

0 comments on commit 74c4a3b

Please sign in to comment.