ts-rest: initQueryClient seems invalid in @ts-rest/react-query
Hey @oliverbutler
First thanks for this amazing tool!
I ran an error while using @ts-rest/react-query : No QueryClient set, use QueryClientProvider to set one (nx, cra/nest)
This problem happens only with the compiled package, I have no error when I copy the client from your monorepo and then create my own lib.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (3 by maintainers)
hello, @oliverbutler , zodios has the same issue with next and
@tanstack/react-query. i don’t think it’s nx related. because the issue was not happening before onreact-queryv3.Here the workaround i applied :
https://github.com/ecyrbe/zodios/issues/191
i also mentioned this bug in
@tanstack/react-queryissues, see link above.Hey @michaelangrivera , I’ll try to reproduce this, it’s a bit frustrating to hear we’re having some issues with the bundled code in NX repos! I’ve seen some similar-looking issues when react-query has been used via another library.
Bundling is admittedly not my strong suit here
@ecyrbe you’re a star, I’ve been away on holiday this last two weeks and have just got back. This will massively help!
Hey @oliverbutler, I just updated, thank you very much it works perfectly ! 😃
Hey @lekinano, it took some toying around, but now all the libs are building with ESM and CommonJS support. Your issue is fixed in 3.6.0!
Enjoy 😃
Hey @lekinano, I’m taking a look now, you’re right this is super weird! I’ve had one interesting discovery so far, if I import tanstack query like ts-rest/react-query does, with “require” I have the same issue.
Thanks for your quick reply 😄 check the repo in
apps/front/src/app/app.tsx