HomePhabricator

[Cashtab] useContext in OrderBook instead of prop drilling

Description

[Cashtab] useContext in OrderBook instead of prop drilling

Summary:
Props that are available from context should come from context and not "prop drilling", aka passing them down from the parent component. Prop drilling can cause performance issues esp for stuff like agora where the component is complex and we might want to load 100s at a time.

I originally wanted to just add websockets to Orderbook in this diff but ran into this as tech debt.

Have to get context first so we can just use our existing websocket. Had to upgrade testing to wrap OrderBook with context.

Cashtab testing has not really migrated to typescript yet but it should. This will also be done incrementally because Cashtab has all kinds of mocks and vectors that need to be typed. Imo the impact is worthwhile (easier to debug tests, easier to write tests, cleaner mocks, standardized mocks make new tests easier to write).

Test Plan:
npm test

later diff in this stack is deployed at https://cashtab-local-dev.netlify.app/

Reviewers: #bitcoin_abc, emack

Reviewed By: #bitcoin_abc, emack

Differential Revision: https://reviews.bitcoinabc.org/D17499

Details

Provenance
bytesofmanAuthored on Thu, Jan 9, 06:12
bytesofmanPushed on Fri, Jan 10, 03:41
Reviewer
Restricted Project
Differential Revision
D17499: [Cashtab] useContext in OrderBook instead of prop drilling
Parents
rABC073bfa519c06: [avalanche] Re-sort pollable contenders by reward rank
Branches
Unknown
Tags
Unknown