From 6f80a48a6dd29e135bc0d8e9bcdfc4d797e56875 Mon Sep 17 00:00:00 2001 From: Kobe Date: Tue, 10 Dec 2024 16:05:58 +0100 Subject: [PATCH] fix: improved state fetching --- .../src/context/TradeProvider.tsx | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/apps/marginfi-v2-trading/src/context/TradeProvider.tsx b/apps/marginfi-v2-trading/src/context/TradeProvider.tsx index 4cfa93096..a83cc06d5 100644 --- a/apps/marginfi-v2-trading/src/context/TradeProvider.tsx +++ b/apps/marginfi-v2-trading/src/context/TradeProvider.tsx @@ -26,8 +26,6 @@ export const TradePovider: React.FC<{ state.initialized, state.hydrationComplete, ]); - - const [fetchPriorityFee] = useUiStore((state) => [state.fetchPriorityFee]); const [isLoggedIn, setIsLoggedIn] = React.useState(false); React.useEffect(() => { @@ -42,18 +40,12 @@ export const TradePovider: React.FC<{ }, [fetchArenaGroups, hydrationComplete, setHydrationComplete]); React.useEffect(() => { - if (!initialized) { - console.log("fetching arena groups"); - fetchArenaGroups(); - } - }, [fetchArenaGroups, initialized]); - - React.useEffect(() => { - if (initialized) { + if (initialized || connected) { + console.log("fetching extended arena groups"); fetchExtendedArenaGroups({ connection, wallet }); } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [initialized, wallet]); + }, [initialized, connected]); React.useEffect(() => { const trackReferral = async (referralCode: string, walletAddress: string) => {