Fix issue with order 0 being ignored

This commit is contained in:
Andrew Kingston 2023-08-01 14:24:06 +01:00
parent cb01768e5a
commit bb810e14d7
1 changed files with 2 additions and 2 deletions

View File

@ -77,13 +77,13 @@ export function enrichSchema(view: View | ViewV2, tableSchema: TableSchema) {
let schema = { ...tableSchema } let schema = { ...tableSchema }
if (view.schemaUI) { if (view.schemaUI) {
const viewOverridesEntries = Object.entries(view.schemaUI) const viewOverridesEntries = Object.entries(view.schemaUI)
const viewSetsOrder = viewOverridesEntries.some(([_, v]) => v.order) const viewSetsOrder = viewOverridesEntries.some(([_, v]) => v.order != null)
for (const [fieldName, schemaUI] of viewOverridesEntries) { for (const [fieldName, schemaUI] of viewOverridesEntries) {
schema[fieldName] = { schema[fieldName] = {
...schema[fieldName], ...schema[fieldName],
...schemaUI, ...schemaUI,
order: viewSetsOrder order: viewSetsOrder
? schemaUI.order || undefined ? schemaUI.order ?? undefined
: schema[fieldName].order, : schema[fieldName].order,
} }
} }