1
0
Fork 0
mirror of synced 2024-09-28 15:21:28 +12:00

More verbose reduce params

This commit is contained in:
Adria Navarro 2024-09-27 11:23:50 +02:00
parent f73cf5983a
commit fdfa451124
2 changed files with 10 additions and 10 deletions

View file

@ -55,10 +55,10 @@ export const deriveStores = context => {
return $rows.map((row, idx) => ({
...row,
__idx: idx,
...customColumns.reduce((acc, c) => {
const fromField = $enrichedSchema[c.related.field]
acc[c.name] = getRelatedTableValues(row, c, fromField)
return acc
...customColumns.reduce((map, column) => {
const fromField = $enrichedSchema[column.related.field]
map[column.name] = getRelatedTableValues(row, column, fromField)
return map
}, {}),
}))
}

View file

@ -40,9 +40,9 @@ export function enrichSchemaWithRelColumns(schema) {
if (!schema) {
return
}
const result = Object.keys(schema).reduce((acc, c) => {
const field = schema[c]
acc[c] = field
const result = Object.keys(schema).reduce((result, fieldName) => {
const field = schema[fieldName]
result[fieldName] = field
if (field.visible !== false && field.columns) {
const fromSingle =
@ -54,17 +54,17 @@ export function enrichSchemaWithRelColumns(schema) {
continue
}
const name = `${field.name}.${relColumn}`
acc[name] = {
result[name] = {
...relField,
name,
related: { field: c, subField: relColumn },
related: { field: fieldName, subField: relColumn },
cellRenderType:
(!fromSingle && columnTypeManyTypeOverrides[relField.type]) ||
relField.type,
}
}
}
return acc
return result
}, {})
return result