Closed barthuijgen closed 1 year ago
Regarding 2 requests - it may be fixed with dedupe exchange of urql, if they're instant, then it may actually able to do twice, but if it take longer (the request), I think it should be deduped on urql client side. TBH, non suspended version was rather an afterthought and hacky. Either way, as a workaround you can use loadable and not rehydrate suspense atom to be false.
Regarding refetch is not refetching. It's not refetch, it's reexecute of the operation. And, same as in original urql react bindings, context matters, namely a networkPolicy. It should be cache-and-network (recommended) or network-only so reexecute will trigger a refetch, if it's cache-only, or cache-first nothing will happen as it will simply read the data from the cache and that is it.
Closing this as not much actionable. Feel free to reopen.
Highly recommend using loadable util instead of disabling suspense. Haven't tested it, but it should work fine.
I have suspense atoms set to false using the
useHydrateAtoms
hookand a simple query like
Simply using it like
Returns in two http requests in the network tab. If set
suspenseAtom
totrue
, it only uses one http request.Aditionally testing refetches resulted in no new http requests, regardless if
suspenseAtom
was true or false.