Skip to content
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

Fix "No queryClient set" when hydrating #2121

Merged
merged 1 commit into from
Apr 14, 2021

Conversation

Ephem
Copy link
Collaborator

@Ephem Ephem commented Apr 14, 2021

Closes #2112

This PR changes the relative import of useQueryClient to an absolute one (from 'react-query'). As described in the issue, this is important to avoid bundling parts of the main package into the hydration entry point and fixes a bug caused by the QueryClientProvider-context not lining up between the different entry points.

I've verified this fixes the broken NextJS-example as well as our code base at work.

Also added TS-resolves for this path so TS knows where to look for the types.

There are more relative imports in the hydration package, but they are all related to types which is fine.

@vercel
Copy link

vercel bot commented Apr 14, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tannerlinsley/react-query/H9kyr9Xvc6UVpuJcYRXpNdtQt1vT
✅ Preview: https://react-query-git-fork-ephem-fix-hydration-query-client-465171.vercel.app

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit af5bae3:

Sandbox Source
tannerlinsley/react-query: basic Configuration
tannerlinsley/react-query: basic-typescript Configuration

@Ephem
Copy link
Collaborator Author

Ephem commented Apr 14, 2021

Doing some extra verification on our project at work before I merge this.

@Ephem Ephem merged commit 2050773 into TanStack:master Apr 14, 2021
@Ephem Ephem deleted the fix-hydration-query-client-context branch April 14, 2021 11:03
@tannerlinsley
Copy link
Collaborator

🎉 This PR is included in version 3.13.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hydration is broken, "No QueryClient set"
3 participants