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

2.3.1: Fix Ethers.send #104

Merged
merged 3 commits into from Aug 23, 2023
Merged

2.3.1: Fix Ethers.send #104

merged 3 commits into from Aug 23, 2023

Conversation

evgenykuzyakov
Copy link
Contributor

@evgenykuzyakov evgenykuzyakov commented Aug 21, 2023

2.3.1

  • Rollback the following change: "Ethers.send to ignore cache and return a promise instead of the cached value". REASON: Too many widgets forked the logic to retrieve accounts using Ethers.send. We'll address it later with cache invalidation strategy. Examples:
    Correct usage:
// Use `Ethers.provider().send()` to get a promise without caching.
if (state.sender === undefined) {
  Ethers.provider().send("eth_requestAccounts", []).then((accounts) => {
    if (accounts.length) {
      State.update({ sender: accounts[0] });
      console.log("set sender", accounts[0]);
    }
  });
}

Legacy example:

// Use `Ethers.send()` to get a cached version, but might run into stale cached data.
if (state.sender === undefined) {
  const accounts = Ethers.send("eth_requestAccounts", []);
  if (accounts.length) {
    State.update({ sender: accounts[0] });
    console.log("set sender", accounts[0]);
  }
}

@evgenykuzyakov evgenykuzyakov merged commit 7c5bfce into master Aug 23, 2023
1 check passed
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

1 participant