chore: use optional chaining for ag-grid api (#1810)

This commit is contained in:
Bartłomiej Głownia 2022-10-21 06:17:36 +02:00 committed by GitHub
parent bb8d2660a0
commit ba9ad40ad2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 9 deletions

View File

@ -23,7 +23,7 @@ const AccountsManager = () => {
const update = useCallback(
({ data }: { data: AccountFields[] | null }) => {
dataRef.current = data;
gridRef.current?.api.refreshInfiniteCache();
gridRef.current?.api?.refreshInfiniteCache();
return true;
},
[gridRef]

View File

@ -28,7 +28,7 @@ export const AccountManager = ({
const update = useCallback(
({ data }: { data: AccountFields[] | null }) => {
dataRef.current = data;
gridRef.current?.api.refreshInfiniteCache();
gridRef.current?.api?.refreshInfiniteCache();
return true;
},
[gridRef]

View File

@ -27,7 +27,7 @@ export const useFillsList = ({ partyId, gridRef, scrolledToTop }: Props) => {
totalCountRef.current += newRows.current;
}
newRows.current = 0;
gridRef.current?.api.refreshInfiniteCache();
gridRef.current?.api?.refreshInfiniteCache();
}, [gridRef]);
const update = useCallback(
@ -48,7 +48,7 @@ export const useFillsList = ({ partyId, gridRef, scrolledToTop }: Props) => {
}
}
dataRef.current = data;
gridRef.current?.api.refreshInfiniteCache();
gridRef.current?.api?.refreshInfiniteCache();
return true;
}
dataRef.current = data;

View File

@ -33,7 +33,7 @@ export const useOrderListData = ({
totalCountRef.current += newRows.current;
}
newRows.current = 0;
gridRef.current?.api.refreshInfiniteCache();
gridRef.current?.api?.refreshInfiniteCache();
}, [gridRef]);
const update = useCallback(
@ -48,7 +48,7 @@ export const useOrderListData = ({
}
}
dataRef.current = data;
gridRef.current?.api.refreshInfiniteCache();
gridRef.current?.api?.refreshInfiniteCache();
return true;
}
dataRef.current = data;

View File

@ -45,7 +45,7 @@ export const usePositionsData = (
const update = useCallback(
({ data }: { data: Position[] | null }) => {
dataRef.current = assetSymbol ? filter(data, { assetSymbol }) : data;
gridRef.current?.api.refreshInfiniteCache();
gridRef.current?.api?.refreshInfiniteCache();
return true;
},
[assetSymbol, gridRef]

View File

@ -35,7 +35,7 @@ export const TradesContainer = ({ marketId }: TradesContainerProps) => {
totalCountRef.current += newRows.current;
}
newRows.current = 0;
gridRef.current?.api.refreshInfiniteCache();
gridRef.current?.api?.refreshInfiniteCache();
}, []);
const update = useCallback(
@ -56,7 +56,7 @@ export const TradesContainer = ({ marketId }: TradesContainerProps) => {
}
}
dataRef.current = data;
gridRef.current?.api.refreshInfiniteCache();
gridRef.current?.api?.refreshInfiniteCache();
return true;
}
dataRef.current = data;