Calling dependent queries declaratively and imperatively
Hi, is there any good way to be able to call dependent queries both via hooks and imperatively? For independent queries, it's great that you can do this
but for dependent queries, I end up having to write it three times
3 Replies
sensitive-blueOP•6d ago
@TkDodo 🔮 any insight?
foreign-sapphire•6d ago
yeah I don't see a way around that, except for combining the queries and caching them together
sensitive-blueOP•3d ago
Thanks. Caching them together breaks invalidation if i need the individual queries too. Do you perceive this to be a missing feature of Query or out of scope?
Something like
new Query() from DB would be awesome. Or just any way for a useQuery hook to be able to inspect what observers it needs to set up for an imperatively composed queryFn. Otherwise using route loaders is painful