Public layout header: fix weird error where the header can disappear

update-emoji-mart
Alex Gleason 2022-07-08 13:50:38 -05:00
rodzic 334857045a
commit f37f4b9e6e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -8,7 +8,7 @@ import { fetchInstance } from 'soapbox/actions/instance';
import { openModal } from 'soapbox/actions/modals';
import SiteLogo from 'soapbox/components/site-logo';
import { Button, Form, HStack, IconButton, Input, Tooltip } from 'soapbox/components/ui';
import { useAppSelector, useFeatures, useSoapboxConfig } from 'soapbox/hooks';
import { useAppSelector, useFeatures, useSoapboxConfig, useOwnAccount } from 'soapbox/hooks';
import Sonar from './sonar';
@ -27,6 +27,7 @@ const Header = () => {
const dispatch = useDispatch();
const intl = useIntl();
const account = useOwnAccount();
const soapboxConfig = useSoapboxConfig();
const pepeEnabled = soapboxConfig.getIn(['extensions', 'pepe', 'enabled']) === true;
const { links } = soapboxConfig;
@ -67,7 +68,7 @@ const Header = () => {
});
};
if (shouldRedirect) return <Redirect to='/' />;
if (account && shouldRedirect) return <Redirect to='/' />;
if (mfaToken) return <Redirect to={`/login?token=${encodeURIComponent(mfaToken)}`} />;
return (