Skip to content

fix(ui): Stop UserProfile crashing after connecting the last Web3 wallet - #9900

Merged
dmoerner merged 4 commits into
mainfrom
daniel/web3-wallet-add-hooks-crash
Sep 24, 2026
Merged

dmoerner merged 4 commits into
mainfrom
daniel/web3-wallet-add-hooks-crash

Conversation

@dmoerner

@dmoerner dmoerner commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Connecting the last unconnected Web3 wallet strategy unmounted the whole UserProfile with "Rendered fewer hooks than expected". Once the wallet is verified, AddWeb3WalletActionMenu returns null before calling useReverification, so it calls fewer hooks than on the previous render. With a single enabled Web3 provider, this happened on every successful connect.

Fix: Call useReverification before the early return.

@f-westergren observed this live while testing a backend Web3 wallet fix. GIF demonstrating the bug before this fix:

CleanShot 2026-09-23 at 1 48 53 PM

Fix:

CleanShot 2026-09-23 at 1 54 58 PM

Description

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Connecting the last unconnected Web3 wallet strategy unmounted the whole
UserProfile with "Rendered fewer hooks than expected". Once the wallet is
verified, AddWeb3WalletActionMenu returns null before calling
useReverification, so it calls fewer hooks than on the previous render.
With a single enabled Web3 provider, this happened on every successful
connect.

Call useReverification before the early return.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Sep 24, 2026 2:46pm UTC
swingset Ready Ready Preview Sep 24, 2026 2:46pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7783b33

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@clerk/ui Patch
@clerk/chrome-extension Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Team

Run ID: 462616ec-32a0-4840-829a-07cb44ab41a8

📥 Commits

Reviewing files that changed from the base of the PR and between 26f1ada and 7783b33.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Team

Run ID: 7981210b-6fb9-4dfb-bde4-04cbe8332d7d

📥 Commits

Reviewing files that changed from the base of the PR and between ee136a9 and eedb049.

📒 Files selected for processing (3)
  • .changeset/web3-wallet-add-hooks-crash.md
  • packages/ui/src/components/UserProfile/Web3Form.tsx
  • packages/ui/src/components/UserProfile/__tests__/Web3Section.test.tsx
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • clerk/clerk_go (manual)
  • clerk/dashboard (manual)
  • clerk/accounts (manual)
  • clerk/backoffice (manual)
  • clerk/clerk (manual)
  • clerk/clerk-docs (manual)
  • clerk/cloudflare-workers (manual)
  • clerk/cli (auto-detected)
  • clerk/clerk-ios (auto-detected)
  • clerk/clerk-android (auto-detected)

Included review availability: 6 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 8 reviews per hour.


📝 Walkthrough

Walkthrough

AddWeb3WalletActionMenu now initializes the createWeb3Wallet reverification callback before it checks for unconnected strategies. It still returns null when none remain. A regression test verifies that the verified MetaMask wallet appears and the connect button disappears after the user resource updates. A patch changeset records the fix.

Priority: ⬇️ Low

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

Suggested reviewers: alexcarpenter

Fixed issue severity: <fixed_issue_severity>Low</fixed_issue_severity>

Merge Risk: ⚪ Minimal · up to eedb0

The last-wallet connection fix has regression coverage, and no actionable issue remains before merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
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.
Title check ✅ Passed The title clearly identifies the UI crash and the specific condition that triggers it: connecting the last Web3 wallet.
Description check ✅ Passed The description directly explains the hook-count crash, identifies the cause in AddWeb3WalletActionMenu, and states the proposed fix. It also includes regression context and visual evidence.

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

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-09-24T14:48:48.174Z

Summary

Metric Count
Packages analyzed 19
Packages with changes 0
🔴 Breaking changes 0
🟡 Non-breaking changes 0
🟢 Additions 0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on 7783b33.

@pkg-pr-new

pkg-pr-new Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@9900

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@9900

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@9900

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@9900

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@9900

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@9900

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@9900

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@9900

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@9900

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@9900

@clerk/express

npm i https://pkg.pr.new/@clerk/express@9900

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@9900

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@9900

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@9900

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@9900

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@9900

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@9900

@clerk/react

npm i https://pkg.pr.new/@clerk/react@9900

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@9900

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@9900

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@9900

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@9900

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@9900

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@9900

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@9900

commit: 7783b33

@wobsoriano wobsoriano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great catch

Comment on lines +28 to +30
const createWeb3Wallet = useReverification((identifier: string) =>
user?.createWeb3Wallet({ web3Wallet: identifier }),
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏🏼

@dmoerner
dmoerner enabled auto-merge (squash) September 24, 2026 14:52
@dmoerner
dmoerner merged commit d2ee830 into main Sep 24, 2026
51 checks passed
@dmoerner
dmoerner deleted the daniel/web3-wallet-add-hooks-crash branch September 24, 2026 14:53

This branch was successfully deployed

2 active deployments
Preview – swingset — 7783b33d Deployed Sep 24, 2026 by vercel[bot]
Preview – clerk-js-sandbox — 7783b33d Deployed Sep 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants