diff --git a/packages/nc-gui/utils/dataUtils.ts b/packages/nc-gui/utils/dataUtils.ts index b5dc9986bb..dbdd9c0f58 100644 --- a/packages/nc-gui/utils/dataUtils.ts +++ b/packages/nc-gui/utils/dataUtils.ts @@ -140,23 +140,17 @@ export const rowDefaultData = (columns: ColumnType[] = []) => { return defaultData } -export const isRowEmpty = (record: Row, col: ColumnType) => { - if (!record || !col) return true +export const isRowEmpty = (record: Row, col: ColumnType): boolean => { + if (!record || !col || !col.title) return true; - const val = record.row[col.title!] - if (val === null || val === undefined || val === '') return true + return !isValidValue(record.row[col.title]); +}; - return Array.isArray(val) && val.length === 0 -} - -export const isRowRecordEmpty = (record: Record, col: ColumnType) => { - if (!record || !col) return true +export const isRowRecordEmpty = (record: Record, col: ColumnType): boolean => { + if (!record || !col || !col.title) return true; - const val = record[col.title!] - if (val === null || val === undefined || val === '') return true - - return Array.isArray(val) && val.length === 0 -} + return !isValidValue(record[col.title]); +}; export function validateRowFilters(_filters: FilterType[], data: any, columns: ColumnType[], client: any) { if (!_filters.length) {