diff --git a/.husky/pre-commit b/.husky/pre-commit
index 6a63f852..73bbdf5c 100755
--- a/.husky/pre-commit
+++ b/.husky/pre-commit
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
-yarn format && yarn typecheck && yarn lint --quiet
+yarn typecheck && yarn lint --quiet && yarn format
diff --git a/components/MangoProvider.tsx b/components/MangoProvider.tsx
index 59a19fcb..23e8bd9f 100644
--- a/components/MangoProvider.tsx
+++ b/components/MangoProvider.tsx
@@ -53,26 +53,16 @@ const HydrateStore = () => {
// watch selected Mango Account for changes
useEffect(() => {
const client = mangoStore.getState().client
-
if (!mangoAccountPk) return
-
const subscriptionId = connection.onAccountChange(
mangoAccountPk,
async (info, context) => {
if (info?.lamports === 0) return
const lastSeenSlot = mangoStore.getState().mangoAccount.lastSlot
- // const mangoAccountLastUpdated = new Date(
- // mangoStore.getState().mangoAccount.lastUpdatedAt
- // )
const mangoAccount = mangoStore.getState().mangoAccount.current
if (!mangoAccount) return
- // const newUpdatedAt = new Date()
- // const timeDiff =
- // mangoAccountLastUpdated.getTime() - newUpdatedAt.getTime()
- // only updated mango account if it's been more than 1 second since last update
- // if (Math.abs(timeDiff) >= 500 && context.slot > lastSeenSlot) {
if (context.slot > lastSeenSlot) {
const decodedMangoAccount = client.program.coder.accounts.decode(
'mangoAccount',
@@ -83,10 +73,8 @@ const HydrateStore = () => {
decodedMangoAccount
)
await newMangoAccount.reloadSerum3OpenOrders(client)
- actions.fetchOpenOrders()
- // newMangoAccount.spotOpenOrdersAccounts =
- // mangoAccount.spotOpenOrdersAccounts
- // newMangoAccount.advancedOrders = mangoAccount.advancedOrders
+ actions.fetchOpenOrders(newMangoAccount)
+
set((s) => {
s.mangoAccount.current = newMangoAccount
s.mangoAccount.lastSlot = context.slot
diff --git a/components/TokenList.tsx b/components/TokenList.tsx
index eb52600e..ca9c9ffb 100644
--- a/components/TokenList.tsx
+++ b/components/TokenList.tsx
@@ -34,6 +34,7 @@ import BankAmountWithValue from './shared/BankAmountWithValue'
import useBanksWithBalances, {
BankWithBalance,
} from 'hooks/useBanksWithBalances'
+import useUnownedAccount from 'hooks/useUnownedAccount'
const TokenList = () => {
const { t } = useTranslation(['common', 'token', 'trade'])
@@ -399,7 +400,7 @@ const ActionsMenu = ({
const router = useRouter()
const { mangoTokens } = useJupiterMints()
const spotMarkets = mangoStore((s) => s.serumMarkets)
- const { connected } = useWallet()
+ const isUnownedAccount = useUnownedAccount()
const spotMarket = useMemo(() => {
return spotMarkets.find((m) => {
@@ -477,7 +478,7 @@ const ActionsMenu = ({
return (
<>
- {mangoAccount && !connected ? null : (
+ {isUnownedAccount ? null : (
{t('settings:notification-position')}