Skip to content

Commit

Permalink
fixup! fixup! Introduce usage of nested RUIProvider (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
bedrich-schindler committed Jul 31, 2024
1 parent 3e1a31d commit cc08ba0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/docs/customize/global-props.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ React.createElement(() => {
});
```

## Nested Usage
## Nesting

Global props can be nested. This is useful e.g. when you want to configure
props across whole application and then override some of them in a specific
Expand Down
10 changes: 5 additions & 5 deletions src/utils/mergeDeep.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export const mergeDeep = (...objects) => objects.reduce((prev, obj) => {
const newObject = { ...prev };

Object.keys(obj).forEach((key) => {
const pVal = prev[key];
const oVal = obj[key];
const previousVal = prev[key];
const currentVal = obj[key];

if (isObject(pVal) && isObject(oVal)) {
newObject[key] = mergeDeep(pVal, oVal);
if (isObject(previousVal) && isObject(currentVal)) {
newObject[key] = mergeDeep(previousVal, currentVal);
} else {
newObject[key] = oVal;
newObject[key] = currentVal;
}
});

Expand Down

0 comments on commit cc08ba0

Please sign in to comment.