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

Cancel any previous fetchAccount calls via axios #954

Merged
merged 1 commit into from
Jan 24, 2025

Conversation

elboletaire
Copy link
Member

This is a trick in order to avoid a race condition that happened sometimes (< 3% of the times) for people having a wallet connected to the application. Wallets are the first thing to load when you refresh a page, because they're browser extensions. Sometimes though, the wallet may load a bit later, causing its fetchAccount call to be computed after the same call done by the remote signer. This caused the remote signer to be set with the wrong address only in part of the state, causing the app to crash in some points with an "Unknown account" error.

This is a trick in order to avoid a race condition that happened
sometimes (< 3% of the times) for people having a metamask wallet connected
to the application. Wallets load the first thing when you refresh a page, because
they're browser extensions. Sometimes though, the wallet may load a bit later,
causing its `fetchAccount` call to be computed after the same call done by the
remote signer. This caused the remote signer to be set with the wrong address
only in part of the state, causing the app to crash in some points with an
"Unknown account" error.
Copy link

@github-actions github-actions bot temporarily deployed to pull request January 24, 2025 16:02 Inactive
Copy link

@github-actions github-actions bot temporarily deployed to pull request January 24, 2025 16:02 Inactive
@elboletaire elboletaire merged commit b473b5f into develop Jan 24, 2025
3 checks passed
@elboletaire elboletaire deleted the b/account-wallets-race-condition branch January 24, 2025 16:06
gerouvi pushed a commit that referenced this pull request Jan 26, 2025
This is a trick in order to avoid a race condition that happened
sometimes (< 3% of the times) for people having a metamask wallet connected
to the application. Wallets load the first thing when you refresh a page, because
they're browser extensions. Sometimes though, the wallet may load a bit later,
causing its `fetchAccount` call to be computed after the same call done by the
remote signer. This caused the remote signer to be set with the wrong address
only in part of the state, causing the app to crash in some points with an
"Unknown account" error.
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