Skip to content

Commit

Permalink
fix: document customizer requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhKumar05 committed Jan 3, 2024
1 parent d62606d commit 53e20eb
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ export const RoomLayoutContext = React.createContext<
| undefined
>(undefined);

// The default merge in lodash merges the values of current layout and the changes.
// This behaviour makes changes in array based values inconsistent since a union happens.
// The customizer uses the new value provided if one of the values is an array
function customizer(objValue: any, srcValue: any) {
if (isArray(objValue) && isArray(srcValue)) {
if (isArray(objValue) || isArray(srcValue)) {
return srcValue;
}
// default mergeWith behaviour is followed
// default merge behaviour is followed
return undefined;
}

Expand Down

0 comments on commit 53e20eb

Please sign in to comment.