Skip to content

fix: correct no modal skip consent event#2469

Open
tuna1207 wants to merge 1 commit intomasterfrom
fix/no-modal-consent-event
Open

fix: correct no modal skip consent event#2469
tuna1207 wants to merge 1 commit intomasterfrom
fix/no-modal-consent-event

Conversation

@tuna1207
Copy link
Copy Markdown
Member

@tuna1207 tuna1207 commented May 1, 2026

Jira Link

Description

Previously we need to update/persist the consent state which is only available in the no-modal, CONSENT is only available for modal and we already have the listener from modalManager. Otherwise, we will need to have two different state management for modal and no-modal to manage the consent state.
This PR remove the consent event listening in no modal which was incorrectly added.

How has this been tested?

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the code style of this project. (run lint)
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Note

Medium Risk
Changes the connectTo promise completion conditions in the no-modal SDK by removing CONSENT_ACCEPTED as a completion trigger, which could affect connection timing/state transitions for apps relying on the previous behavior.

Overview
Fixes no-modal connection completion to no longer resolve connectTo() based on CONNECTOR_EVENTS.CONSENT_ACCEPTED; it now completes only on CONNECTED (and AUTHORIZED in connect-and-sign mode).

Updates consent-related tests to match the new flow and refactors test setup with an emitMetaMaskConnected helper, plus disables analytics in the test SDK factory to reduce noise.

Reviewed by Cursor Bugbot for commit df7fc66. Bugbot is set up for automated code reviews on this repo. Configure here.

@tuna1207 tuna1207 requested a review from a team as a code owner May 1, 2026 13:10
@vercel
Copy link
Copy Markdown

vercel Bot commented May 1, 2026

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

Project Deployment Actions Updated (UTC)
web3auth-web Ready Ready Preview, Comment May 1, 2026 1:10pm

Request Review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit df7fc66. Configure here.

const onConsentAccepted = async () => {
await completeConnection();
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale listeners from connectTo when consent required

Medium Severity

Removing the CONSENT_ACCEPTED listener from connectTo causes the promise to hang indefinitely when consentRequired is true. The modal SDK sets consentRequired = true and internally calls connectTo from onSocialLogin and onExternalWalletLogin. When consent is required, the subscribeToConnectorEvents CONNECTED handler emits CONSENT_REQUIRING instead of CONNECTED, so connectTo's onConnected never fires and cleanup() is never called. The stale once listeners for CONNECTED, ERRORED, and AUTHORIZED accumulate on the SDK and can fire on subsequent connections, causing duplicate CONNECTION_COMPLETED analytics events.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit df7fc66. Configure here.

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