T
TanStack•3y ago
like-gold

one query depending on another

Hi, i have a situation where my useItem query depends on my useFormOptions query, and sometimes useItem finishes fetching before useFormOptions. What would be the correct way to always prefetch form options (or fetch if stale) before actually fetching item?
4 Replies
deep-jade
deep-jade•3y ago
use the enabled flag on useItem?
unwilling-turquoise
unwilling-turquoise•3y ago
enabled is used exactly for this usecase.
enabled: !!formOptionsId
enabled: !!formOptionsId
like-gold
like-goldOP•3y ago
They don't share variables I wanted to ask if there's a configuration like flag to make one query dependant on another
optimistic-gold
optimistic-gold•3y ago
Yes, it's enabled 😅

Did you find this page helpful?