When wallet changing was initially implemented, there was an issue with the function being called too frequently -- for example if the user rapidly scrolls through wallets.
A complex debounce was implemented to prevent this from causing infinite looping between wallet switches.
However, the debounce uses useRef, which means that the function is defined with a certain associated cashtabState. When it is called and updates cashtab state, it changes the wallet on top of the old cashtab state (for example if the user has changed settings in the meantime, the old settings come back).
We can't accept this behavior. The problem of "user selects wallets too fast now there's an issue" is more tolerable -- also I am unable to repeat this legacy problem that caused the debounce implementation. Perhaps it was associated with some other past behavior the app that has been patched.