From 67dc41776d2689ddbe57df4724078de58bf02a05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Sadzi=C5=84ski?= Date: Mon, 13 Nov 2023 16:01:59 +0100 Subject: [PATCH] (core) Treating null in toggle column as a valid value Summary: When action is pruned by ACL rules, the rule engine sometimes rewrites actions, setting NULLs for boolean columns as a default value. Null was not considered a valid value and it resulted in a bug in the UI where the editor for the Toggle column was not rendered. Test Plan: Added new Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D4110 --- app/common/gristTypes.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/common/gristTypes.ts b/app/common/gristTypes.ts index ebd73c09..9f68807e 100644 --- a/app/common/gristTypes.ts +++ b/app/common/gristTypes.ts @@ -172,6 +172,7 @@ export function isEmptyList(value: CellValue): boolean { function isNumber(v: CellValue) { return typeof v === 'number' || typeof v === 'boolean'; } function isNumberOrNull(v: CellValue) { return isNumber(v) || v === null; } function isBoolean(v: CellValue) { return typeof v === 'boolean' || v === 1 || v === 0; } +function isBooleanOrNull(v: CellValue) { return isBoolean(v) || v === null; } // These values are not regular cell values, even in a column of type Any. const abnormalValueTypes: string[] = [GristObjCode.Exception, GristObjCode.Pending, GristObjCode.Skip, @@ -191,7 +192,7 @@ const rightType: {[key in GristType]: (value: CellValue) => boolean} = { Text: isString, Blob: isString, Int: isNumberOrNull, - Bool: isBoolean, + Bool: isBooleanOrNull, Date: isNumberOrNull, DateTime: isNumberOrNull, Numeric: isNumberOrNull,