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.