ProfilePage: load full account correctly, fix hidden tabs from !1630
This commit is contained in:
parent
9a0531db37
commit
e37611d55b
|
@ -16,7 +16,7 @@ import {
|
||||||
PinnedAccountsPanel,
|
PinnedAccountsPanel,
|
||||||
} from 'soapbox/features/ui/util/async-components';
|
} from 'soapbox/features/ui/util/async-components';
|
||||||
import { useAppSelector, useFeatures, useSoapboxConfig } from 'soapbox/hooks';
|
import { useAppSelector, useFeatures, useSoapboxConfig } from 'soapbox/hooks';
|
||||||
import { findAccountByUsername } from 'soapbox/selectors';
|
import { findAccountByUsername, makeGetAccount } from 'soapbox/selectors';
|
||||||
import { getAcct, isLocal } from 'soapbox/utils/accounts';
|
import { getAcct, isLocal } from 'soapbox/utils/accounts';
|
||||||
|
|
||||||
interface IProfilePage {
|
interface IProfilePage {
|
||||||
|
@ -25,12 +25,21 @@ interface IProfilePage {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getAccount = makeGetAccount();
|
||||||
|
|
||||||
/** Page to display a user's profile. */
|
/** Page to display a user's profile. */
|
||||||
const ProfilePage: React.FC<IProfilePage> = ({ params, children }) => {
|
const ProfilePage: React.FC<IProfilePage> = ({ params, children }) => {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const username = params?.username || '';
|
const username = params?.username || '';
|
||||||
|
|
||||||
const account = useAppSelector(state => username ? findAccountByUsername(state, username) : undefined);
|
const account = useAppSelector(state => {
|
||||||
|
if (username) {
|
||||||
|
const account = findAccountByUsername(state, username);
|
||||||
|
if (account) {
|
||||||
|
return getAccount(state, account.id) || undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const me = useAppSelector(state => state.me);
|
const me = useAppSelector(state => state.me);
|
||||||
const features = useFeatures();
|
const features = useFeatures();
|
||||||
|
@ -82,7 +91,7 @@ const ProfilePage: React.FC<IProfilePage> = ({ params, children }) => {
|
||||||
activeItem = 'profile';
|
activeItem = 'profile';
|
||||||
}
|
}
|
||||||
|
|
||||||
const showTabs = !['following', 'followers', 'pins'].some(path => pathname.includes(path));
|
const showTabs = !['/following', '/followers', '/pins'].some(path => pathname.endsWith(path));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
Loading…
Reference in New Issue