Any way to pause URQL query when using atomWithQuery? #608
-
First off, great work on binding these two phenomenal libraries. Really excited to start using both in my projects. There is one thing I need before I can switch my URQL useQuery usages over to atomWithQuery, and that is the Some of my query variables aren't available when the component mounts so it would be nice if I get use the something like:
I checked the implementation and it seems to only accept these config options:
Would also be really nice if we could also have the query re-run when other (not query variable atoms) get changed, like:
^ but this would only be a really nice addition wishlist item 😄 Anyone have any advice how I can make the atomWithQuery query wait? I am pretty sure there might be a Jotai way to already achieve this that I can't think of right now. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi, very nice to see someone trying jotai/uqrl integration. Happy to help, but bear with me as I'm not super familiar with urql. For a start, we discussed about something. As far as I understand, the suggestion was: const baseAtom = atomWithQuery(
(get) => ({
query: 'query goes here...',
variables: {
someKey: get(asyncValueAtom)
},
}),
() => client
)
const dataAtom = atom((get) => get(asyncValueAtom) !== null && get(baseAtom)) The general idea is to follow |
Beta Was this translation helpful? Give feedback.
Hi, very nice to see someone trying jotai/uqrl integration. Happy to help, but bear with me as I'm not super familiar with urql.
For a start, we discussed about something.
#463 (comment)
Let me know if that makes sense or not.
As far as I understand, the suggestion was:
The general idea is to follow
useQuery
use cases. I wonder if useQuery suspends (with<Suspense>
) with pause?