Svelte and Dependent Queries #8763
Unanswered
EugeneDraitsev
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
I'm using Svelte 5 and TanStack Query 5.67.1, and I need to reuse queries across multiple components. However, some queries depend on the results of others, and I'm not sure how to properly handle this with TanStack Query.
My simplidied code looks like that (
$lib/store/test.store.ts
):The issue is that
enabled
inqueryB
does not reactively updates when queryA becomes successful. Sinceget(queryA).isSuccess
is evaluated once when the store is initialized, queryB doesn't behave as expected.I also tried something like that:
but this doesn't seem like the right way to solve this problem
How should I properly make queryB reactive to queryA's state?
Are there best practices for handling dependent queries in Svelte with TanStack Query?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions