-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
@tanstack/react-query-devtools
v5.0.0 doesn't work out-of-the-box on Next.js
#5369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @ardeora , I've troubleshooted this a bit. It seems like the solidjs build adds its own internal library logic at the top of the build output, followed by your package's logic which starts at ~line 5000. The specific Since I don't get this issue in the svelte adapter, this could probably be fixed at the react adapter level. I'm not sure if there's something as easy as |
I hit that in my live-stream yesterday as well 😅 |
@ardeora @TkDodo I wonder if this SSR workaround is an unavoidable change that will need to be made for Next.js and other React SSR metaframework users - I can confirm the |
Thanks @lachlancollins I think there are two options here.
Both approach seems fine I feel the lazy import on the framework agnostic devtools might make it easier to create other framework adapters but I cant think what other side effects it might have. Would love to hear your thoughts on this |
Yeah option 1 sounds good 👍 |
@ardeora I agree, building it into the agnostic adapter sounds better 👍 I did try using React.lazy within the react adapter and that didn't work, but solidjs might do things differently! |
Describe the bug
The server error issue is raised when running
yarn dev
of Next.js when importingReactQueryDevtools
:This is raised because there's no
document
on the server side. This can be currently worked around by using dynamic import:ReactQueryDevtools
could be imported in next.js normally and without issue in v4.Your minimal, reproducible example
Steps to reproduce
in a next.js app:
yarn add @tanstack/[email protected]
import {ReactQueryDevtools} from '@tanstack/react-query-devtools'
to_app.tsx
<ReactQueryDevtools />
to the renderyarn dev
Expected behavior
no error
How often does this bug happen?
Every time
Screenshots or Videos
Platform
macOS, Chrome. shouldn't matter
Tanstack Query adapter
react-query
TanStack Query version
5.0.0-alpha.26 for query, 5.0.0-alpha.30 for devtools
TypeScript version
5.0.4
Additional context
No response
The text was updated successfully, but these errors were encountered: