fix(wagmi): add resetSSRState method to prevent cross-request state leakage#5615
fix(wagmi): add resetSSRState method to prevent cross-request state leakage#5615
Conversation
…eakage In Next.js App Router with SSR, the WagmiAdapter is typically created as a module-level singleton. This can cause cross-request state leakage where one user's wallet connection state bleeds into another user's server-rendered HTML. This commit adds a `resetSSRState()` method that resets the wagmi config state when `cookieToInitialState` returns undefined (i.e., when the user has no wallet cookies). This prevents showing another user's wallet address in SSR. REOWN-4523 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
9 Skipped Deployments
|
|
|
All contributors have signed the CTA ✍️ ✅ |
Visual Regression Test Results ✅ PassedChromatic Build: https://www.chromatic.com/build?appId=6493191bf4b10fed8ca7353f&number=872 👉 Please review the visual changes in Chromatic and accept or reject them. |
📦 Bundle Size Check✅ All bundles are within size limits 📊 View detailed bundle sizes> @reown/appkit-monorepo@1.7.1 size /home/runner/work/appkit/appkit > size-limit |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
|
I have read the CTA Document and I hereby sign the CTA |
Summary
resetSSRState()method to WagmiAdapter to prevent cross-request state leakage in Next.js SSRFixes REOWN-4523
Changes
packages/adapters/wagmi/src/client.ts
resetSSRState()method that clears connections, sets current to null, and status to 'disconnected'examples/next-wagmi-app-router/src/app/layout.tsx
examples/next-wagmi-app-router/src/config/index.ts
ssr: trueto WagmiAdapter configurationpackages/adapters/wagmi/src/tests/client.test.ts
resetSSRState()methodTest plan
Branch:
khizr-fixes/REOWN-4523🤖 Generated with Claude Code