Page MenuHomePhabricator

[Cashtab] Make sure selectedOffer cannot be undefined after a ws update
ClosedPublic

Authored by bytesofman on Tue, Jan 21, 11:38.

Details

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.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable