(core) Fixing selectby error on the creator panel.

Summary: [Select By] in the creator panel was bugged. It wasn't refreshed in some cases as the observable array that needed to be created seemed too complicated. This Diff recomputes this array when the user wants to change the selection.

Test Plan: added tests

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3541
This commit is contained in:
Jarosław Sadziński
2022-07-21 16:46:26 +02:00
parent 938928f1b9
commit 5c8211c61d
3 changed files with 21 additions and 13 deletions

View File

@@ -189,7 +189,7 @@ export function fromTableDataAction(tableData: TableDataAction): TableColValues
* Convert a list of rows into an object with columns of values, used for
* BulkAddRecord/BulkUpdateRecord actions.
*/
export function getColValues(records: RowRecord[]): BulkColValues {
export function getColValues(records: Partial<RowRecord>[]): BulkColValues {
const colIdSet = new Set<string>();
for (const r of records) {
for (const c of Object.keys(r)) {
@@ -200,7 +200,7 @@ export function getColValues(records: RowRecord[]): BulkColValues {
}
const result: BulkColValues = {};
for (const colId of colIdSet) {
result[colId] = records.map(r => r[colId]);
result[colId] = records.map(r => r[colId]!);
}
return result;
}