TanStackT
TanStack2y ago
4 replies
moderate-tomato

TypeError: Cannot read properties of undefined (reading 'length') at accessRows

I'm sure that I'm passing table data that is not empty but I still get this error. Does anyone encounter this problem?

I'm using Remix.btw

const categories = [
{
id: "1",
version: 1,
status: SimpleStatus.ACTIVE,
categoryName: "pasta",
branchId: "12",
businessId: "13",
createdAt: new Date(),
createdBy: "Ad",
updatedAt: new Date(),
updatedBy: "Ad",
},
{
id: "2",
version: 1,
status: SimpleStatus.ACTIVE,
categoryName: "pasta",
branchId: "12",
businessId: "13",
createdAt: new Date(),
createdBy: "Ad",
updatedAt: new Date(),
updatedBy: "Ad",
},
] as Category[];

console.log(categories.length); // it logs 2

const table = useReactTable({
categories,
columns,
getCoreRowModel: getCoreRowModel(),
});

TypeError: Cannot read properties of undefined (reading 'length')
at accessRows (file:///.../node_modules/@tanstack/table-core/src/utils/getCoreRowModel.ts:31:44)
Was this page helpful?