-
Notifications
You must be signed in to change notification settings - Fork 117
Open
Description
Currently context/Dex.ts and context/Token.ts use a hacky approach to update state.
Line 227 in 4a92cad
| const [refresh, setRefresh] = useState(0); |
A useState hook explicitly for refreshing is used after new values for _ORDERBOOK_CACHE are fetched via websockets. Ideally the orderbook data itself should be stored in useState(); that way updating this value will automatically refresh the UI.
Secondly there's double fetching of same data
- Websocket listens to changes in bid or asks, then calls
setRefesh(). The fetched value is discarded, the only purpose of this was to update the UI again. - The bid and ask data is fetched again using a
useAsynchook
This should be resolved by the mentioned solution.
munanadi
Metadata
Metadata
Assignees
Labels
No labels