Recommended approach when data is undefined?
Hey! I'm using TanStack Query (tRPC) to fetch the data my Table should display. That means that it could be undefined. What's the recommended pattern here? Passing an empty array or allowing undefined in the types? Something else?
2 Replies
optimistic-gold•2y ago
I also have the same question, did you find out any solutions for this?
adverse-sapphire•2y ago
I found a structure online that I think works well, wherein you have an AccountTableQuery component that takes care of the query and returns some loading/skeleton until your data is successfully fetched.
When the data is successfully fetched, ATQ calls AccountTableInstance which sets up the account table instance, which in turns calls AccountTableLayout which contains all the HTML stuff.