(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]; values = [true, false];
} else if (['Choice', 'ChoiceList'].includes(columnType)) { } else if (['Choice', 'ChoiceList'].includes(columnType)) {
const options = fieldOrColumn.origCol().widgetOptionsJson; 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}])); return new Map(values.map((v) => [v, {label: String(v), count: 0, displayValue: v}]));
} }

View File

@ -1371,7 +1371,7 @@ export async function setType(type: RegExp, options: {skipWait?: boolean} = {})
await toggleSidePanel('right', 'open'); await toggleSidePanel('right', 'open');
await driver.find('.test-right-tab-field').click(); await driver.find('.test-right-tab-field').click();
await driver.find('.test-fbuilder-type-select').click(); await driver.find('.test-fbuilder-type-select').click();
await driver.findContentWait('.test-select-menu .test-select-row', type, 200).click(); await driver.findContentWait('.test-select-menu .test-select-row', type, 500).click();
if (!options.skipWait) { await waitForServer(); } if (!options.skipWait) { await waitForServer(); }
} }
@ -1949,7 +1949,7 @@ export async function addColumn(name: string) {
// If we are on a summary table, we could be see a menu helper // If we are on a summary table, we could be see a menu helper
const menu = (await driver.findAll('.grist-floating-menu'))[0]; const menu = (await driver.findAll('.grist-floating-menu'))[0];
if (menu) { if (menu) {
await menu.findContent("li", name).click(); await menu.findContent("li", "Add Column").click();
} }
await waitForServer(); await waitForServer();
await waitAppFocus(false); await waitAppFocus(false);