Issue with Real-time Table Data not Rendering
Hello there, I'd love to know if there are any references or examples for React with live or real-time table data. I'm bumping into some surprising behavior where I have a setup like so:
const data = useData() // updating once a second
const table = useReactTable({ data })
const { virtualItems } = useTableVirtualizer({ table })
<div>
{virtualItems.map(virtualRow => {
const row = table.getRowModel().rows[virtualRow.index]
return <div>
{row.getVisibleCells().map(cell => (
<div>{flexRender(cell.getContext())}</div>
))}
</div>
})}
</div>
Even though data is changing once a second, and logs confirm those changes, none of the updates are reflecting in the table view. If I force a re-render in the parent then the most recent data appears. If there are any pointers for live data that would be much appreciated!
Thank you 🙏
1 Reply
sunny-green•2y ago
How are you updating your data?
As in, what's used to fetch? Tanstack-query?