Skip to content

bug: Maximum update depth exceeded in tRPC's <HydrateClient> #2120

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

Open
bohdancho opened this issue May 8, 2025 · 1 comment
Open

bug: Maximum update depth exceeded in tRPC's <HydrateClient> #2120

bohdancho opened this issue May 8, 2025 · 1 comment

Comments

@bohdancho
Copy link

bohdancho commented May 8, 2025

Provide environment information

System:
OS: macOS 15.4
CPU: (8) arm64 Apple M3
Memory: 208.34 MB / 16.00 GB
Shell: 3.7.1 - /opt/homebrew/bin/fish
Binaries:
Node: 23.11.0 - /opt/homebrew/bin/node
npm: 10.9.2 - /opt/homebrew/bin/npm
pnpm: 10.6.2 - ~/Library/pnpm/pnpm
bun: 1.2.8 - ~/.bun/bin/bun
Watchman: 2025.04.14.00 - /opt/homebrew/bin/watchman

Describe the bug

Running a scaffolded app with tRPC results in the following error from <HydrateClient> in the browser console:
Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.

Reproduction repo

https://github.com/bohdancho/t3-app-tanstack-query-hydrateclient-bug

To reproduce

  1. Clone the repository
  2. Setup environment variables for Discord OAuth
  3. Sign in
  4. Confirm that the error is present in the browser console

Additional information

This is a known issue of TanStack Query. As per TanStack/query#8677 (comment), this bug was introduced in Tanstack Query v5.66.4. I suggest pinning the version to v5.66.3 until the issue is resolved upstream.

I would be happy to file a PR for this.

P.S.
The reproduction repository was initialized with the following settings:

  • Tailwind
  • tRPC
  • NextAuth.js
  • No ORM
  • App router
  • ESLint+Prettier
@yukosgiti
Copy link

Happened to me as well

with prisma orm and no auth, the rest are the same

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

No branches or pull requests

2 participants