T
TanStack3y ago
correct-apricot

Tables freezing once interacted with

Hi I’m having an issue with tanstack tables, being freezing of the whole React application/browser after having a row selected, attempts to sorted, writing in search bar for filtering or navigating pages. Any ideas? Thanks
15 Replies
quickest-silver
quickest-silver3y ago
Did you check rerenders?
fair-rose
fair-rose3y ago
same issue can someone help please wdym?
{
id: "select",
header: ({ table }) => (
<Checkbox
checked={table.getIsAllPageRowsSelected()}
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
aria-label="Select all"
/>
),
cell: ({ row }) => (
<Checkbox
checked={row.getIsSelected()}
onCheckedChange={(value) => {
//row.toggleSelected(!!value)
console.log(row.getIsSelected());
row.toggleSelected();
}}
aria-label="Select row"
/>
),
enableSorting: false,
enableHiding: false,
},
{
id: "select",
header: ({ table }) => (
<Checkbox
checked={table.getIsAllPageRowsSelected()}
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
aria-label="Select all"
/>
),
cell: ({ row }) => (
<Checkbox
checked={row.getIsSelected()}
onCheckedChange={(value) => {
//row.toggleSelected(!!value)
console.log(row.getIsSelected());
row.toggleSelected();
}}
aria-label="Select row"
/>
),
enableSorting: false,
enableHiding: false,
},
const table = useReactTable({
data: dataWithToken,
columns: columns,
onSortingChange: setSorting,
onColumnFiltersChange: setColumnFilters,
getCoreRowModel: getCoreRowModel(),
getPaginationRowModel: getPaginationRowModel(),
getSortedRowModel: getSortedRowModel(),
getFilteredRowModel: getFilteredRowModel(),
onColumnVisibilityChange: setColumnVisibility,
onRowSelectionChange: setRowSelection,
enableRowSelection: true,
enableMultiRowSelection: true,
state: {
sorting,
columnFilters,
columnVisibility,
rowSelection,
},
});
const table = useReactTable({
data: dataWithToken,
columns: columns,
onSortingChange: setSorting,
onColumnFiltersChange: setColumnFilters,
getCoreRowModel: getCoreRowModel(),
getPaginationRowModel: getPaginationRowModel(),
getSortedRowModel: getSortedRowModel(),
getFilteredRowModel: getFilteredRowModel(),
onColumnVisibilityChange: setColumnVisibility,
onRowSelectionChange: setRowSelection,
enableRowSelection: true,
enableMultiRowSelection: true,
state: {
sorting,
columnFilters,
columnVisibility,
rowSelection,
},
});
fair-rose
fair-rose3y ago
Data Table
Powerful table and datagrids built using TanStack Table.
fair-rose
fair-rose3y ago
i followed this
fair-rose
fair-rose3y ago
GitHub
Data table row selection, totally breaks when selecting a row · Iss...
I followed the component example and it freezes the entire page once i click on one of the select icons. const table = useReactTable({ data: dataWithToken, columns: columns, onSortingChange: setSor...
wise-white
wise-white3y ago
I don't see where you data is defined, but this is almost certainly an infinite loop caused by not giving your data a stable reference
fair-rose
fair-rose3y ago
by data is a state the table is inside a component where i send the state value which is the data but that states doesn't change what should i do? could it be caused by this map
const dataWithToken: DataType[] = data.map((guild) => {
return {
guild,
token,
securityToken,
};
});
const dataWithToken: DataType[] = data.map((guild) => {
return {
guild,
token,
securityToken,
};
});
.
constant-blue
constant-blue3y ago
You need to memoize that
fair-rose
fair-rose3y ago
how? i mean where ?
constant-blue
constant-blue3y ago
useMemo , inline
fair-rose
fair-rose3y ago
at the data with token or at columns?¿
constant-blue
constant-blue3y ago
ask chatgpt how to memoize data with useMemo
fair-rose
fair-rose3y ago
but i mean what imemonize the original data or the columns
constant-blue
constant-blue3y ago
dataWithToken
fair-rose
fair-rose3y ago
ty bro ❤️

Did you find this page helpful?