diff --git a/apps/marginfi-v2-ui/src/hooks/useEffectOnce.ts b/apps/marginfi-v2-ui/src/hooks/useEffectOnce.ts
new file mode 100644
index 0000000000..287d7336c4
--- /dev/null
+++ b/apps/marginfi-v2-ui/src/hooks/useEffectOnce.ts
@@ -0,0 +1,6 @@
+import { EffectCallback, useEffect } from "react";
+
+export function useEffectOnce(effect: EffectCallback) {
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ useEffect(effect, []);
+}
diff --git a/apps/marginfi-v2-ui/src/pages/portfolio.tsx b/apps/marginfi-v2-ui/src/pages/portfolio.tsx
index 1dd953df93..20ce11cb42 100644
--- a/apps/marginfi-v2-ui/src/pages/portfolio.tsx
+++ b/apps/marginfi-v2-ui/src/pages/portfolio.tsx
@@ -44,25 +44,29 @@ const PortfolioPage = () => {
const lendingBanks = useMemo(
() =>
- sortedBanks && isStoreInitialized ?
- sortedBanks
- .filter((b) => b.info.rawBank.config.assetWeightInit.toNumber() > 0)
- .filter((b) => b.isActive && b.position.isLending)
- .sort(
- (a, b) => b.info.state.totalDeposits * b.info.state.price - a.info.state.totalDeposits * a.info.state.price
- ) : [],
+ sortedBanks && isStoreInitialized
+ ? sortedBanks
+ .filter((b) => b.info.rawBank.config.assetWeightInit.toNumber() > 0)
+ .filter((b) => b.isActive && b.position.isLending)
+ .sort(
+ (a, b) =>
+ b.info.state.totalDeposits * b.info.state.price - a.info.state.totalDeposits * a.info.state.price
+ )
+ : [],
[sortedBanks, isStoreInitialized]
);
const borrowingBanks = useMemo(
() =>
- sortedBanks && isStoreInitialized ?
- sortedBanks
- .filter((b) => b.info.rawBank.config.assetWeightInit.toNumber() > 0)
- .filter((b) => b.isActive && !b.position.isLending)
- .sort(
- (a, b) => b.info.state.totalDeposits * b.info.state.price - a.info.state.totalDeposits * a.info.state.price
- ) : [],
+ sortedBanks && isStoreInitialized
+ ? sortedBanks
+ .filter((b) => b.info.rawBank.config.assetWeightInit.toNumber() > 0)
+ .filter((b) => b.isActive && !b.position.isLending)
+ .sort(
+ (a, b) =>
+ b.info.state.totalDeposits * b.info.state.price - a.info.state.totalDeposits * a.info.state.price
+ )
+ : [],
[sortedBanks, isStoreInitialized]
);
@@ -149,7 +153,7 @@ const PortfolioPage = () => {
{sortedBanks && (
-