TableNG: Fallback to AutoCell when cellType is unmapped (#107920)

This commit is contained in:
Paul Marbach
2025-07-09 17:29:13 +00:00
committed by GitHub
parent 5612edd8b5
commit 9aaaa87bcf
2 changed files with 9 additions and 1 deletions
@@ -141,6 +141,14 @@ describe('TableNG Cells renderers', () => {
expect(container).toBeInTheDocument();
expect(container.childNodes).toHaveLength(1);
});
it('should return AutoCell when cellOptions is unmapped', () => {
const field = createField(FieldType.string);
const { container } = renderCell(field, { type: 'number' } as unknown as TableCellOptions);
expect(container).toBeInTheDocument();
expect(container.childNodes).toHaveLength(1);
});
});
});
@@ -109,7 +109,7 @@ export function getCellRenderer(field: Field, cellOptions: TableCellOptions): Ta
if (cellType === TableCellDisplayMode.Auto) {
return getAutoRendererResult(field);
}
return CELL_RENDERERS[cellType];
return CELL_RENDERERS[cellType] ?? AUTO_RENDERER;
}
/** @internal */