#Is it possible to async fetch subrows?

10 messages · Page 1 of 1 (latest)

somber geyser
#

For a project with a lot of layering it would be nice if I can fetch the subrows asynchronously. Would this be possible? I can't find an example for it.

I was thinking about using either a custom component for the subrows that does its own data fetching or manipulating a cache for the entire table.

Does anyone have experience with this? @teal arrow maybe:)?

teal arrow
#

I'll be the first to admit that this is a tedious pattern to try and implement right now

#

You have to hoist all of the expansion state out of the table and use it along with something like useQueries to fetch all of the data you need. Then you have to stitch it together in the right hierarchy and pass it to your table.

devout lantern
#

It's probably one of a dozen ways to do it. It's somewhat complicated on the back-end, especially if supporting sorting, filtering, and pagination

#

React Query caching makes it somewhat more performant at least

somber geyser
#

Cool thanks a lot for the responses!

somber geyser
#

Team backend will never forgive me

bronze needle
#

what is bugging me is the loading state, for the global one I've figured out that I can use the table meta object.

But with lazy sub-rows I need to know when every subrows is loading or not 🤔