Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle multiple event handlers for the same event #4560

Merged
merged 1 commit into from
May 24, 2024

Conversation

schmanu
Copy link
Contributor

@schmanu schmanu commented May 24, 2024

Description

Currently when calling the Wallet Connect wallet's on function it registers the onSessionProposal handler multiple times in the signClient.
This causes each event to be called as many times as there are event handlers registered for the event.

This fix always calls off before calling on when setting the onSessionProposal handler.

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Draft PR (breaking/non-breaking change which needs more work for having a proper functionality [Mark this PR as ready to review only when completely ready])
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How has this been tested?

I added a unit test which caught the issue.

Checklist

  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Additional Information (Optional)

The bug came up while working on safe-global/safe-wallet-monorepo#3656 and the fix is required to unblock it.

Sorry, something went wrong.

Copy link
Member

@ganchoradkov ganchoradkov left a comment

Choose a reason for hiding this comment

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

Many thanks for the investigation & fixing 💯 💯 💯 💯

@ganchoradkov ganchoradkov merged commit 4613df2 into WalletConnect:v2.0 May 24, 2024
4 of 11 checks passed
@ganchoradkov ganchoradkov mentioned this pull request May 29, 2024
20 tasks
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.

None yet

2 participants