From 1b8570783397308715dc72d16a719d3d68d95033 Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Wed, 9 Feb 2022 20:43:11 +0100 Subject: [PATCH] Bugfix: Only fall back to default value if sanitizer returns undefined Fixes #72 --- theatre/core/src/sheetObjects/SheetObject.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/theatre/core/src/sheetObjects/SheetObject.ts b/theatre/core/src/sheetObjects/SheetObject.ts index 08d2bad..c5544f3 100644 --- a/theatre/core/src/sheetObjects/SheetObject.ts +++ b/theatre/core/src/sheetObjects/SheetObject.ts @@ -169,12 +169,21 @@ export default class SheetObject implements IdentityDerivationProvider { if (!triple) return valsAtom.setIn(pathToProp, propConfig!.default) - const left = sanitize(triple.left) || propConfig.default + const leftSanitized = sanitize(triple.left) + + const left = + typeof leftSanitized === 'undefined' + ? propConfig.default + : leftSanitized if (triple.right === undefined) return valsAtom.setIn(pathToProp, left) - const right = sanitize(triple.right) || propConfig.default + const rightSanitized = sanitize(triple.right) + const right = + typeof rightSanitized === 'undefined' + ? propConfig.default + : rightSanitized return valsAtom.setIn( pathToProp,