handle empty meta during v3 transform

This commit is contained in:
Fendy Heryanto
2026-01-30 09:56:44 +00:00
parent 02bde3233b
commit be7198a875
2 changed files with 6 additions and 12 deletions

View File

@@ -38,7 +38,7 @@ export async function getFormulasReferredTheColumn(
if (UITypes.Button === c.uidt && (formula as ButtonColumn)?.type !== 'url')
return columns;
if (fn(formulaJsep(formula.formula))) {
if (formula.formula && fn(formulaJsep(formula.formula))) {
columns.push(c);
}
return columns;

View File

@@ -430,8 +430,7 @@ export const columnBuilder = builderGenerator<Column | ColumnType, FieldV3Type>(
}
if (data.type === UITypes.Checkbox) {
const { icon, iconIdx, ...rest } = data.options as Record<string, any>;
const { icon, iconIdx, ...rest } = options;
// extract option meta and include only label and color
options = rest;
@@ -443,7 +442,7 @@ export const columnBuilder = builderGenerator<Column | ColumnType, FieldV3Type>(
)?.label;
}
} else if (data.type === UITypes.Rating) {
const { icon, iconIdx, ...rest } = data.options as Record<string, any>;
const { icon, iconIdx, ...rest } = options;
// extract option meta and include only label and color
options = rest;
@@ -456,10 +455,7 @@ export const columnBuilder = builderGenerator<Column | ColumnType, FieldV3Type>(
)?.label;
}
} else if (data.type === UITypes.Duration) {
const { duration, duration_format, ...rest } = data.options as Record<
string,
any
>;
const { duration, duration_format, ...rest } = options;
const durationFormat = duration ?? duration_format;
// extract option meta and include only label and color
options = rest;
@@ -468,7 +464,7 @@ export const columnBuilder = builderGenerator<Column | ColumnType, FieldV3Type>(
options.duration_format = durationOptions[durationFormat]?.title;
}
} else if (data.type === UITypes.Button) {
const { type, ...rest } = data.options as Record<string, any>;
const { type, ...rest } = options;
// Transform button properties based on type
if (type === 'formula') {
@@ -514,11 +510,9 @@ export const columnBuilder = builderGenerator<Column | ColumnType, FieldV3Type>(
options = { ...rest, button_type: type };
}
} else if (isLinksOrLTAR(data.type)) {
const { type, ...rest } =
(data.options as Record<string, any>) ?? options;
const { type, ...rest } = options;
options = { ...rest, relation_type: type };
}
options = options || data.options;
// exclude rollup function if Links
if (data.type === UITypes.Links && options && options.rollup_function) {