Fix/945: Orderbook memory leak (#978)
* fix: cancel throttle on unmount * fix: format * fix: lint
This commit is contained in:
parent
9a2ac6a8ac
commit
25c3ac8b4a
@ -83,6 +83,7 @@ export const OrderbookManager = ({ marketId }: OrderbookManagerProps) => {
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const throttleRunnner = updateOrderbookData.current;
|
||||
if (!data) {
|
||||
dataRef.current = { rows: null };
|
||||
setOrderbookData(dataRef.current);
|
||||
@ -94,6 +95,10 @@ export const OrderbookManager = ({ marketId }: OrderbookManagerProps) => {
|
||||
...mapMarketData(data.data, resolution),
|
||||
};
|
||||
setOrderbookData(dataRef.current);
|
||||
|
||||
return () => {
|
||||
throttleRunnner.cancel();
|
||||
};
|
||||
}, [data, resolution]);
|
||||
|
||||
useEffect(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user