diff --git a/app/soapbox/features/ui/components/navbar.tsx b/app/soapbox/features/ui/components/navbar.tsx index 69b2d528c..dfe76a541 100644 --- a/app/soapbox/features/ui/components/navbar.tsx +++ b/app/soapbox/features/ui/components/navbar.tsx @@ -6,7 +6,7 @@ import { Link } from 'react-router-dom'; import { Avatar, Button, Icon } from 'soapbox/components/ui'; import Search from 'soapbox/features/compose/components/search'; -import { useAccount, useSoapboxConfig, useSettings } from 'soapbox/hooks'; +import { useOwnAccount, useSoapboxConfig, useSettings } from 'soapbox/hooks'; import { openSidebar } from '../../../actions/sidebar'; @@ -16,7 +16,7 @@ const Navbar = () => { const dispatch = useDispatch(); const node = React.useRef(null); - const account = useAccount(); + const account = useOwnAccount(); const settings = useSettings(); const soapboxConfig = useSoapboxConfig(); const singleUserMode = soapboxConfig.get('singleUserMode'); diff --git a/app/soapbox/hooks/index.ts b/app/soapbox/hooks/index.ts index c5ea01d3d..1bce19299 100644 --- a/app/soapbox/hooks/index.ts +++ b/app/soapbox/hooks/index.ts @@ -1,5 +1,5 @@ -export { useAccount } from './useAccount'; export { useAppSelector } from './useAppSelector'; export { useOnScreen } from './useOnScreen'; +export { useOwnAccount } from './useOwnAccount'; export { useSettings } from './useSettings'; export { useSoapboxConfig } from './useSoapboxConfig'; diff --git a/app/soapbox/hooks/useAccount.ts b/app/soapbox/hooks/useOwnAccount.ts similarity index 63% rename from app/soapbox/hooks/useAccount.ts rename to app/soapbox/hooks/useOwnAccount.ts index f6be45060..6a5937f0b 100644 --- a/app/soapbox/hooks/useAccount.ts +++ b/app/soapbox/hooks/useOwnAccount.ts @@ -7,7 +7,7 @@ import type Account from 'soapbox/types/entities/account'; // FIXME: getAccount() has the wrong type?? const getAccount: (state: any, accountId: any) => any = makeGetAccount(); -/** Get an account from the store (by default, your own account) */ -export const useAccount = (accountId?: string): Account => { - return useAppSelector((state) => getAccount(state, accountId || state.me)); +/** Get the logged-in account from the store, if any */ +export const useOwnAccount = (): Account | null => { + return useAppSelector((state) => getAccount(state, state.me)); };