[Cashtab] Make sure selectedOffer cannot be undefined after a ws update
Summary:
We update activeOffers every time there is an agora action on the websocket subscription. However, if that action resulted in an offer being canceled or fully accepted, it is possible the selected offer will be undefined after activeOffers are updated.
We want selectedIndex to always be zero when active offers are updated. This also ensures the spot offer is selected by default.
Test Plan:
npm test
Find a token pair with 1 offer. Create another offer higher than spot. Select it. Cancel the offer.
We do not get a white screen app failure like we do now.
Not (easily) tested directly as I have not managed to mock ws events in existing tests.
Reviewers: #bitcoin_abc, emack
Reviewed By: #bitcoin_abc, emack
Differential Revision: https://reviews.bitcoinabc.org/D17571