From cc08ba03c1322577f322afe214c30be053223bca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bed=C5=99ich=20Schindler?= Date: Wed, 31 Jul 2024 14:05:59 +0200 Subject: [PATCH] fixup! fixup! Introduce usage of nested `RUIProvider` (#541) --- src/docs/customize/global-props.md | 2 +- src/utils/mergeDeep.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/docs/customize/global-props.md b/src/docs/customize/global-props.md index 54ce1e69..71f14731 100644 --- a/src/docs/customize/global-props.md +++ b/src/docs/customize/global-props.md @@ -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 diff --git a/src/utils/mergeDeep.js b/src/utils/mergeDeep.js index b3174141..b5b8ab5b 100644 --- a/src/utils/mergeDeep.js +++ b/src/utils/mergeDeep.js @@ -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; } });