Skip to content

fix(providers): mount QueryClientProvider while the wagmi config loads - #4

Open
sktbrd wants to merge 1 commit into
BuilderOSS:mainfrom
sktbrd:fix/query-client-provider-gate
Open

fix(providers): mount QueryClientProvider while the wagmi config loads#4
sktbrd wants to merge 1 commit into
BuilderOSS:mainfrom
sktbrd:fix/query-client-provider-gate

Conversation

@sktbrd

@sktbrd sktbrd commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Web3Providers creates the wagmi config inside an effect, so config is null during SSR and on the first client render. That branch returned stores without QueryClientProvider, so any component calling useQuery while it was live threw No QueryClient set.

This is 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 throws, the error propagates to the route, and the page returns a 500.

The fix

Wrap stores in QueryClientProvider in the !config branch too. The WagmiProviderQueryClientProviderRainbowKitProvider nesting in the resolved branch is untouched.

queryClient is 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:

Route without the fix with the fix
/proposals/1 500 200
/proposals/5 500 200
/dev/proposal 500 200
  • pnpm 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/proposal still returns 500 because it renders ProposalTransactionList directly outside ProposalDetailView.

This PR is independent of #3: it branches from main and touches only src/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

  • Bug Fixes
    • Ensured data-fetching features continue to work when Web3 configuration is unavailable.
    • Improved consistency by providing shared query support across all application states.

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>
@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

@sktbrd is attempting to deploy a commit to the Nouns Builder Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7150c2f2-7573-460a-bb0c-e4cefac3472d

📥 Commits

Reviewing files that changed from the base of the PR and between c33b9b0 and e0d94e8.

📒 Files selected for processing (1)
  • src/app/web3-providers.tsx

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Web3Providers now provides the shared query client in the unconfigured wagmi state. The configured state remains unchanged.

Changes

Web3 query provider

Layer / File(s) Summary
Wrap the unconfigured branch with QueryClientProvider
src/app/web3-providers.tsx
The unconfigured branch now wraps stores with the module-level queryClient before returning the provider tree.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to e0d94

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: r4topunk

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: mounting QueryClientProvider while the wagmi configuration loads.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant