Skip to content

fix(core): catch connector.isAuthorized() rejection in reconnect and revalidate - #5235

Open
lx3133584 wants to merge 1 commit into
wevm:mainfrom
lx3133584:fix/reconnect-catch-is-authorized-rejection
Open

fix(core): catch connector.isAuthorized() rejection in reconnect and revalidate#5235
lx3133584 wants to merge 1 commit into
wevm:mainfrom
lx3133584:fix/reconnect-catch-is-authorized-rejection

Conversation

@lx3133584

Copy link
Copy Markdown

Problem

When a connector's isAuthorized() method throws or rejects (e.g. stale WalletConnect session, unreachable relay, or transport network failure), reconnect() and createConfig's revalidate() fail unhandled. This left the config state permanently stranded in the reconnecting status and kept the internal isReconnecting lock flag true, preventing all subsequent reconnection attempts from running.

Cause

reconnect() and createConfig.revalidate() awaited connector.isAuthorized() without a .catch() handler, unlike neighboring connector.getProvider() and connector.connect(). A thrown rejection propagated out of the function before isReconnecting could be reset and before config.setState could update the status to disconnected.

Fix

  • Added .catch(() => false) to connector.isAuthorized() in packages/core/src/actions/reconnect.ts and packages/core/src/createConfig.ts.
  • Wrapped the body of reconnect in a try ... finally block to guarantee isReconnecting is reset to false even if unexpected errors occur.
  • Replaced in-place mutation of state.connections during revalidate() with a fresh Map copy so state subscribers receive proper updates.

Testing

  • Added unit tests in packages/core/src/actions/reconnect.test.ts and packages/core/src/createConfig.test.ts verifying that reconnect and revalidate recover gracefully when isAuthorized rejects and allow subsequent reconnect calls to succeed.

@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

@lx3133584 is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8eaa20a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

…revalidate

Signed-off-by: Liang Xu <lx3133584@users.noreply.github.com>
@lx3133584
lx3133584 force-pushed the fix/reconnect-catch-is-authorized-rejection branch from 8dc47b9 to 8eaa20a Compare August 28, 2026 21:11
cultosagent added a commit to cultosagent/dogma-registry that referenced this pull request Aug 30, 2026
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