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(() => {
|
useEffect(() => {
|
||||||
|
const throttleRunnner = updateOrderbookData.current;
|
||||||
if (!data) {
|
if (!data) {
|
||||||
dataRef.current = { rows: null };
|
dataRef.current = { rows: null };
|
||||||
setOrderbookData(dataRef.current);
|
setOrderbookData(dataRef.current);
|
||||||
@ -94,6 +95,10 @@ export const OrderbookManager = ({ marketId }: OrderbookManagerProps) => {
|
|||||||
...mapMarketData(data.data, resolution),
|
...mapMarketData(data.data, resolution),
|
||||||
};
|
};
|
||||||
setOrderbookData(dataRef.current);
|
setOrderbookData(dataRef.current);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
throttleRunnner.cancel();
|
||||||
|
};
|
||||||
}, [data, resolution]);
|
}, [data, resolution]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user