(core) Fix error when filtering empty choice and choice list columns

Summary:
A client error should no longer be thrown when filtering an empty Choice
or Choice List column.

Test Plan: Browser tests.

Reviewers: alexmojaki

Reviewed By: alexmojaki

Subscribers: alexmojaki

Differential Revision: https://phab.getgrist.com/D3528
This commit is contained in:
George Gevoian
2022-07-15 10:24:11 -07:00
parent 1a6e1872de
commit c70b427483
2 changed files with 3 additions and 3 deletions

View File

@@ -342,7 +342,7 @@ function getEmptyCountMap(fieldOrColumn: ViewFieldRec|ColumnRec): Map<CellValue,
values = [true, false];
} else if (['Choice', 'ChoiceList'].includes(columnType)) {
const options = fieldOrColumn.origCol().widgetOptionsJson;
values = options.prop('choices')();
values = options.prop('choices')() ?? [];
}
return new Map(values.map((v) => [v, {label: String(v), count: 0, displayValue: v}]));
}