From 50d46835eb9c10f3a54670737c597fe2cc66448d Mon Sep 17 00:00:00 2001 From: David Menc Date: Tue, 17 Sep 2024 09:58:19 +0200 Subject: [PATCH] Fix layout context prop resolving for boolean types (#567) --- src/components/_helpers/resolveContextOrProp.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/_helpers/resolveContextOrProp.js b/src/components/_helpers/resolveContextOrProp.js index 4bfb49e1..f69cd116 100644 --- a/src/components/_helpers/resolveContextOrProp.js +++ b/src/components/_helpers/resolveContextOrProp.js @@ -1,7 +1,10 @@ export const resolveContextOrProp = (contextValue, propValue) => { - if (contextValue != null) { - return contextValue; + // We need to test: + // * `false` - for when the `contextValue` is boolean + // * `null` - for when the `contextValue` is non-boolean + if (contextValue === false || contextValue === null) { + return propValue; } - return propValue; + return contextValue; };