web icon indicating copy to clipboard operation
web copied to clipboard

Swapper multi-account infinite toggle

Open gomesalexandre opened this issue 2 years ago • 0 comments

Overview

Currently in develop/prod, there is an infinite toggle between swapper accounts in swapper.

Steps to reproduce:

  • In swapper, select a sell asset for which you have either no balance on account 1+, or no balance on all accounts altogether
  • Then, select a sell asset for which your highest balance is on account 1+
  • Notice how the accounts toggle infinitely

Alternatively

  • Select a sell asset for which your highest balance is on account 1+
  • Notice how account 1 is selected
  • Select account 0
  • Reselect the same asset from the asset selection modal
  • Notice how the accounts toggle infinitely

References and additional details

A similar issue currently exists in FOX/ETH farming/LP when account 1 is autoselected and account 0 also has a balance, which might be a similar bug.

That's because onChange gets fired back and forth with the previous/current AccountId:

https://github.com/shapeshift/web/blob/e69906f95940a3e3b8dffc7831875f4ec15db1e8/src/components/AccountDropdown/AccountDropdown.tsx#L113

The offender for both bugs is most likely this guy being fired when it shouldn't

https://github.com/shapeshift/web/blob/e69906f95940a3e3b8dffc7831875f4ec15db1e8/src/components/AccountDropdown/AccountDropdown.tsx#L128

Acceptance Criteria

  • There is no infinite toggle between accounts

Need By Date

No response

Screenshots/Mockups

https://user-images.githubusercontent.com/17035424/196702698-64870fd6-20db-4e94-a78d-fa8d84776e4b.mov

Estimated effort

No response

gomesalexandre avatar Oct 19 '22 13:10 gomesalexandre