blitz
blitz copied to clipboard
Cannot use Blitz toolkit beta with @tanstack/react-query installed elsewhere in a monorepo
What is the problem?
I am using the Blitz toolkit beta in a monorepo setup, where I have a apps/blitz
and another apps/docs
folder. The blitz folder contains my blitz application, the docs folder contains a separate Next project for documentation.
For some reason, Blitz is requiring me to set public-hoist-pattern[]=@tanstack/react-query
in my .npmrc
file at the root of my monorepo. Blitz seems to be using version 4.0.10 of react-query.
However, when I install @tanstack/react-query
in the apps/docs
folder, it is, of course, using the latest version of react-query, which is 4.24.*. This breaks my blitz app, which seems to rely on the exact 4.0.10 version.
Paste all your error logs here:
Error: No QueryClient set, use QueryClientProvider to set one
at Object.useQueryClient (/Users/Jan/Desktop/project/node_modules/.pnpm/@[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/@tanstack/react-query/build/cjs/react-query/src/QueryClientProvider.js:68:11)
at Object.useMutation (/Users/Jan/Desktop/project/node_modules/.pnpm/@[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/@tanstack/react-query/build/cjs/react-query/src/useMutation.js:43:43)
at useMutation (/Users/Jan/Desktop/project/node_modules/.pnpm/@[email protected]_z23kptem44zej6xtmrdyaua4dm/node_modules/@blitzjs/rpc/dist/index-browser.cjs:135:25)
at AdminPanel (/Users/Jan/Desktop/project/apps/app/.next/server/chunks/1744.js:1463:87)
at Wc (/Users/Jan/Desktop/project/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/Users/Jan/Desktop/project/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/Users/Jan/Desktop/project/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at Zc (/Users/Jan/Desktop/project/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:481)
at Z (/Users/Jan/Desktop/project/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at Zc (/Users/Jan/Desktop/project/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:481)
Paste all relevant code snippets here:
.
What are detailed steps to reproduce this?
- Create a mono repo using PNPM
- Create a blitz app inside it
- Create another app that uses @tanstack/react-query with the latest version
- try to build the Blitz app, you'll get an error
Run blitz -v
and paste the output here:
Package manager: npm
System:
OS: macOS 12.6.3
CPU: (8) arm64 Apple M1 Pro
Memory: 1.05 GB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 19.7.0 - /opt/homebrew/bin/node
Yarn: Not Found
npm: 9.5.0 - /opt/homebrew/bin/npm
npmPackages:
@blitzjs/auth: 2.0.0-beta.23 => 2.0.0-beta.23
@blitzjs/next: 2.0.0-beta.23 => 2.0.0-beta.23
@blitzjs/rpc: 2.0.0-beta.23 => 2.0.0-beta.23
@prisma/client: ^4.10.1 => 4.10.1
blitz: 2.0.0-beta.23 => 2.0.0-beta.23
next: 12.3.1 => 12.3.1
prisma: ^4.10.1 => 4.10.1
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
typescript: ^4.9.5 => 4.9.5
Please include below any other applicable logs and screenshots that show your problem:
No response
Hey @jan-wilhelm, thanks for the issue. We will have to discuss whether to allow a more flexible versioning of react query used in the RPC package
@siddhsuresh I overode the version to latest in my repo without any regressions, it is safe to update