From ba9ad40ad281614f8bef75126383f7c698c08c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20G=C5=82ownia?= Date: Fri, 21 Oct 2022 06:17:36 +0200 Subject: [PATCH] chore: use optional chaining for ag-grid api (#1810) --- .../src/app/components/portfolio/accounts/accounts.tsx | 2 +- libs/accounts/src/lib/accounts-manager.tsx | 2 +- libs/fills/src/lib/use-fills-list.ts | 4 ++-- .../lib/components/order-list-manager/use-order-list-data.ts | 4 ++-- libs/positions/src/lib/use-positions-data.tsx | 2 +- libs/trades/src/lib/trades-container.tsx | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/console-lite/src/app/components/portfolio/accounts/accounts.tsx b/apps/console-lite/src/app/components/portfolio/accounts/accounts.tsx index 3a59883b1..a6f19a0f6 100644 --- a/apps/console-lite/src/app/components/portfolio/accounts/accounts.tsx +++ b/apps/console-lite/src/app/components/portfolio/accounts/accounts.tsx @@ -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] diff --git a/libs/accounts/src/lib/accounts-manager.tsx b/libs/accounts/src/lib/accounts-manager.tsx index 0ac6aba9a..de22b06b7 100644 --- a/libs/accounts/src/lib/accounts-manager.tsx +++ b/libs/accounts/src/lib/accounts-manager.tsx @@ -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] diff --git a/libs/fills/src/lib/use-fills-list.ts b/libs/fills/src/lib/use-fills-list.ts index e4dcc9d63..ae752304b 100644 --- a/libs/fills/src/lib/use-fills-list.ts +++ b/libs/fills/src/lib/use-fills-list.ts @@ -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; diff --git a/libs/orders/src/lib/components/order-list-manager/use-order-list-data.ts b/libs/orders/src/lib/components/order-list-manager/use-order-list-data.ts index 0a4cf95d8..afce998c5 100644 --- a/libs/orders/src/lib/components/order-list-manager/use-order-list-data.ts +++ b/libs/orders/src/lib/components/order-list-manager/use-order-list-data.ts @@ -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; diff --git a/libs/positions/src/lib/use-positions-data.tsx b/libs/positions/src/lib/use-positions-data.tsx index 24d714123..8b353d846 100644 --- a/libs/positions/src/lib/use-positions-data.tsx +++ b/libs/positions/src/lib/use-positions-data.tsx @@ -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] diff --git a/libs/trades/src/lib/trades-container.tsx b/libs/trades/src/lib/trades-container.tsx index 7f123c8c1..f100f6845 100644 --- a/libs/trades/src/lib/trades-container.tsx +++ b/libs/trades/src/lib/trades-container.tsx @@ -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;