(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
pull/758/head
Jarosław Sadziński 7 months ago
parent 68801474b1
commit 67dc41776d

@ -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,

Loading…
Cancel
Save