fix(providers): mount QueryClientProvider while the wagmi config loads - #4
fix(providers): mount QueryClientProvider while the wagmi config loads#4sktbrd wants to merge 1 commit into
Conversation
Web3Providers creates the wagmi config in an effect, so `config` is null on the first client render and during SSR. That branch returned `stores` with no QueryClientProvider, so any component calling useQuery while it was live threw "No QueryClient set". This was reachable from ordinary pages, not just edge cases: ProposalTransactionList renders a Row per transaction, Row calls useDecodedTx, and useDecodedTx calls useQuery. Rendering that during SSR threw, so the error propagated to the route and /proposals/[id] returned a 500. /dev/proposal 500'd for the same reason via its decoded-tx taxonomy section. Verified against a dev server, same commit, fix stashed and unstashed: without the fix /proposals/1 500 /proposals/5 500 /dev/proposal 500 with the fix /proposals/1 200 /proposals/5 200 /dev/proposal 200 queryClient is a module-level singleton, so both branches share one cache and nothing is refetched when the config resolves and the tree swaps. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
@sktbrd is attempting to deploy a commit to the Nouns Builder Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review. 📝 WalkthroughWalkthrough
ChangesWeb3 query provider
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized provider change prevents pages from rendering without the required query context, with reported tests, lint, and build checks passing. No actionable merge-blocking risk remains beyond normal review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Web3Providerscreates the wagmi config inside an effect, soconfigisnullduring SSR and on the first client render. That branch returnedstoreswithoutQueryClientProvider, so any component callinguseQuerywhile it was live threwNo QueryClient set.This is reachable from ordinary pages, not just edge cases.
ProposalTransactionListrenders aRowper transaction,RowcallsuseDecodedTx, anduseDecodedTxcallsuseQuery. Rendering that during SSR throws, the error propagates to the route, and the page returns a 500.The fix
Wrap
storesinQueryClientProviderin the!configbranch too. TheWagmiProvider→QueryClientProvider→RainbowKitProvidernesting in the resolved branch is untouched.queryClientis a module-level singleton, so both branches share one cache — nothing is refetched when the config resolves and the tree swaps.Verification
Same commit, same dev server, fix stashed and unstashed:
/proposals/1/proposals/5/dev/proposalpnpm test— 76/76 passing.pnpm lint(tsc --noEmit+ eslint) — 0 errors. The 5<img>warnings are pre-existing and unrelated.pnpm build— passes.Relationship to #3
#3 (proposal page polish) documents this bug and works around it by accident: tabbing the page means the transaction list only mounts after hydration, so the page loads instead of 500ing. That masks the problem rather than fixing it — with #3 alone, opening the Transactions tab still trips the error boundary before recovering, and
/dev/proposalstill returns 500 because it rendersProposalTransactionListdirectly outsideProposalDetailView.This PR is independent of #3: it branches from
mainand touches onlysrc/app/web3-providers.tsx. Either can merge first. Together they leave no path to the missing-provider error.Raised by CodeRabbit on #3; sending the fix rather than opening a tracking issue since it's four lines.
🤖 Generated with Claude Code
Summary by CodeRabbit