gqty icon indicating copy to clipboard operation
gqty copied to clipboard

useTransactionQuery never fetches

Open cdomigan opened this issue 10 months ago • 2 comments

Very excited by this library - thank you!

I was trying to debug my useTransactionQuery() never making a fetch request, regardless of cache settings. On inspection, turns out it wraps useQuery with a prepare and all refetch options set to false. So I tested useQuery with these options, and it never fetches either.

Please see sandbox for example: https://codesandbox.io/p/sandbox/d4tw43

(I've replaced fetcher with a console.log("..."), which never fires.)

I should expect both examples to do an initial fetch, right?

cdomigan avatar Feb 28 '25 21:02 cdomigan

Yes, in hindsight it is relying on the suspense option. A $refetch() should be invoked on the first render with skip and suspense disabled. I'll make a PR soon and you may test again with the canary version there.

vicary avatar Mar 01 '25 12:03 vicary

Thank you @vicary 🙂

cdomigan avatar Mar 01 '25 18:03 cdomigan