(core) API fix for a bug that treated 0 as null

Summary: Bug with 'records' endpoint that was treating 0 as null.

Test Plan: Modified tests

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3262
This commit is contained in:
Jarosław Sadziński 2022-02-12 01:01:10 +01:00
parent 7cc3092e1b
commit 66eb0b91b8

View File

@ -272,7 +272,7 @@ export class DocWorkerApi {
const fieldNames = new Set<string>(_.flatMap(records, r => Object.keys(r.fields ?? {})));
const result: BulkColValues = {};
for (const fieldName of fieldNames) {
result[fieldName] = records.map(record => record.fields?.[fieldName] || null);
result[fieldName] = records.map(record => record.fields?.[fieldName] ?? null);
}
return result;
}