diff --git a/src/components/activity/MyNotifications.tsx b/src/components/activity/MyNotifications.tsx
index e62c96124..92b45c589 100644
--- a/src/components/activity/MyNotifications.tsx
+++ b/src/components/activity/MyNotifications.tsx
@@ -10,13 +10,13 @@ const NOTIFICATION_TITLE = 'My notifications'
export const MyNotifications = () => {
const myAddress = useMyAddress()
- const isInitializedProxy = useMyAccount(state => state.isInitializedProxy)
+ const isInitialized = useMyAccount(state => state.isInitialized)
if (!myAddress) return
return (
- {!isInitializedProxy ? (
+ {!isInitialized ? (
) : (
diff --git a/src/components/activity/NotifCounter.tsx b/src/components/activity/NotifCounter.tsx
index d428b0101..af9227f7c 100644
--- a/src/components/activity/NotifCounter.tsx
+++ b/src/components/activity/NotifCounter.tsx
@@ -34,7 +34,7 @@ function InnerNotifCounterProvider(props: React.PropsWithChildren<{}>) {
storageKeyType: 'user',
})
const myAddress = useMyAddress()
- const isInitializedProxy = useMyAccount(state => state.isInitializedProxy)
+ const isInitialized = useMyAccount(state => state.isInitialized)
const [unreadCount, setUnreadCount] = useState(0)
const [previousLastRead, setPreviousLastRead] = useState(null)
@@ -47,7 +47,7 @@ function InnerNotifCounterProvider(props: React.PropsWithChildren<{}>) {
}
useEffect(() => {
- if (!isInitializedProxy || !myAddress) return
+ if (!isInitialized || !myAddress) return
;(async () => {
const unreadCount = await getNotificationsCount({
address: myAddress,
@@ -55,7 +55,7 @@ function InnerNotifCounterProvider(props: React.PropsWithChildren<{}>) {
})
setUnreadCount(unreadCount)
})()
- }, [myAddress, isInitializedProxy])
+ }, [myAddress, isInitialized])
return (
(
export const NotificationsBell = ({ unreadCount }: NotificationsProps) => {
const myAddress = useMyAddress()
- const isInitializedProxy = useMyAccount(state => state.isInitializedProxy)
+ const isInitialized = useMyAccount(state => state.isInitialized)
const { getLastReadNotif } = useNotifCounterContext()
if (!enableNotifications) return null
- if (!unreadCount || unreadCount <= 0 || !isInitializedProxy)
- return
+ if (!unreadCount || unreadCount <= 0 || !isInitialized) return
const showWithoutCount = !getLastReadNotif(myAddress)
diff --git a/src/stores/my-account.ts b/src/stores/my-account.ts
index 94966edab..aa073fef9 100644
--- a/src/stores/my-account.ts
+++ b/src/stores/my-account.ts
@@ -16,7 +16,14 @@ import { useAnalytics } from './analytics'
import { create } from './utils'
type State = {
+ /**
+ * `isInitialized` is `true` when the addresses (address & parentProxyAddress) are all set
+ * but there is still a case where the proxy is invalid and user will be logged out after that
+ */
isInitialized?: boolean
+ /**
+ * `isInitializedProxy` is `true` when the initialization process is all done, including checking the proxy
+ */
isInitializedProxy?: boolean
preferredWallet: any | null