query icon indicating copy to clipboard operation
query copied to clipboard

solid-query 4.20.2 and 4.20.4 fail to set queryClient in dev mode with vite

Open eyenalxai opened this issue 2 years ago • 2 comments

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

  1. Create a solid project
  2. Install solid-query 4.20.2 or 4.20.4
  3. 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

eyenalxai avatar Dec 23 '22 06:12 eyenalxai

@ardeora fyi

TkDodo avatar Dec 23 '22 06:12 TkDodo

Thanks! I'm taking a look at this.

ardeora avatar Dec 23 '22 20:12 ardeora

For the sake of reproducibility I get this also with both the latest Deno and Nodejs. On macOS and Firefox.

tsujp avatar Dec 28 '22 02:12 tsujp

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.

ardeora avatar Dec 29 '22 03:12 ardeora

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 😭

ardeora avatar Dec 29 '22 06:12 ardeora

this might be related https://github.com/thisbeyond/solid-dnd/issues/78

thetarnav avatar Feb 02 '23 18:02 thetarnav

I'll close this issue because a) it's an upstream issue and b) I think @ardeora has reverted the change

TkDodo avatar Aug 29 '23 08:08 TkDodo