query
query copied to clipboard
solid-query 4.20.2 and 4.20.4 fail to set queryClient in dev mode with vite
Describe the bug
On versions 4.20.2 and above I get Uncaught Error: No QueryClient set, use QueryClientProvider to set one, but only in dev mode.
After build works fine. Previous version, 4.19.1, also works well in dev mode, as expected.
Your minimal, reproducible example
4.20.2 (Not working): https://stackblitz.com/edit/solidjs-templates-bkmykc 4.19.1 (Same code, working): https://stackblitz.com/edit/solidjs-templates-qwuff7
Repo with code used: https://github.com/eyenalxai/solid-query-bug
Steps to reproduce
- Create a solid project
- Install solid-query 4.20.2 or 4.20.4
- Perform initial configuration, add some fetching code
Expected behavior
I expected Uncaught Error: No QueryClient set not to happen but it did.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: MacOS
- Browser: Chrome, Safari
Tanstack Query version
4.20.2 and 4.20.4
TypeScript version
4.8.2 and 4.5.4
Additional context
No response
@ardeora fyi
Thanks! I'm taking a look at this.
For the sake of reproducibility I get this also with both the latest Deno and Nodejs. On macOS and Firefox.
Thank you so much for the thorough reproduction. I am still working on this and just posting this as an update. Building the library locally and using the build from the local server, The library works as expected. I published @adeora/solid-query with the exact same code to npm and I am getting the exact issue again. On first look, I'm thinking this is an issue somewhere where vite cannot correctly resolve the package. I'll keep you posted on my findings.
Update: I was able to create a minimal reproduction of this issue without any Tanstack query code and issue still persists. It seems like something maybe vite-plugin-solid cannot resolve correctly. More detailed explanation in the issue here on how to recreate the issue https://github.com/solidjs/vite-plugin-solid/issues/80. Hopefully we shall hear back soon! If not, I'll just revert the changes back to the older version for now. I apologize for all the inconvenience caused here ðŸ˜
this might be related https://github.com/thisbeyond/solid-dnd/issues/78
I'll close this issue because a) it's an upstream issue and b) I think @ardeora has reverted the change