Fix wrong account rendered on Account page

This commit is contained in:
Lim Chee Aun 2025-02-01 09:57:39 +08:00
parent 8ba431b001
commit 2f39e8ff27
2 changed files with 28 additions and 25 deletions

40
src/locales/en.po generated
View file

@ -100,7 +100,7 @@ msgstr "Following"
#: src/components/account-info.jsx:423 #: src/components/account-info.jsx:423
#: src/components/account-info.jsx:780 #: src/components/account-info.jsx:780
#: src/pages/account-statuses.jsx:483 #: src/pages/account-statuses.jsx:479
#: src/pages/search.jsx:328 #: src/pages/search.jsx:328
#: src/pages/search.jsx:475 #: src/pages/search.jsx:475
msgid "Posts" msgid "Posts"
@ -116,7 +116,7 @@ msgstr ""
#: src/components/status.jsx:1875 #: src/components/status.jsx:1875
#: src/components/status.jsx:2479 #: src/components/status.jsx:2479
#: src/components/status.jsx:2482 #: src/components/status.jsx:2482
#: src/pages/account-statuses.jsx:527 #: src/pages/account-statuses.jsx:523
#: src/pages/accounts.jsx:110 #: src/pages/accounts.jsx:110
#: src/pages/hashtag.jsx:200 #: src/pages/hashtag.jsx:200
#: src/pages/list.jsx:158 #: src/pages/list.jsx:158
@ -980,7 +980,7 @@ msgid "Poll"
msgstr "" msgstr ""
#: src/components/drafts.jsx:250 #: src/components/drafts.jsx:250
#: src/pages/account-statuses.jsx:364 #: src/pages/account-statuses.jsx:360
msgid "Media" msgid "Media"
msgstr "" msgstr ""
@ -1377,7 +1377,7 @@ msgid "Followed Hashtags"
msgstr "" msgstr ""
#: src/components/nav-menu.jsx:262 #: src/components/nav-menu.jsx:262
#: src/pages/account-statuses.jsx:330 #: src/pages/account-statuses.jsx:326
#: src/pages/filters.jsx:54 #: src/pages/filters.jsx:54
#: src/pages/filters.jsx:93 #: src/pages/filters.jsx:93
#: src/pages/hashtag.jsx:340 #: src/pages/hashtag.jsx:340
@ -2525,69 +2525,69 @@ msgstr ""
msgid "{accountDisplay} ({monthYear})" msgid "{accountDisplay} ({monthYear})"
msgstr "" msgstr ""
#: src/pages/account-statuses.jsx:320 #: src/pages/account-statuses.jsx:316
msgid "Clear filters" msgid "Clear filters"
msgstr "" msgstr ""
#: src/pages/account-statuses.jsx:323 #: src/pages/account-statuses.jsx:319
msgid "Clear" msgid "Clear"
msgstr "" msgstr ""
#: src/pages/account-statuses.jsx:337 #: src/pages/account-statuses.jsx:333
msgid "Showing post with replies" msgid "Showing post with replies"
msgstr "" msgstr ""
#: src/pages/account-statuses.jsx:342 #: src/pages/account-statuses.jsx:338
msgid "+ Replies" msgid "+ Replies"
msgstr "" msgstr ""
#: src/pages/account-statuses.jsx:348 #: src/pages/account-statuses.jsx:344
msgid "Showing posts without boosts" msgid "Showing posts without boosts"
msgstr "" msgstr ""
#: src/pages/account-statuses.jsx:353 #: src/pages/account-statuses.jsx:349
msgid "- Boosts" msgid "- Boosts"
msgstr "" msgstr ""
#: src/pages/account-statuses.jsx:359 #: src/pages/account-statuses.jsx:355
msgid "Showing posts with media" msgid "Showing posts with media"
msgstr "" msgstr ""
#. placeholder {0}: tag.name #. placeholder {0}: tag.name
#: src/pages/account-statuses.jsx:376 #: src/pages/account-statuses.jsx:372
msgid "Showing posts tagged with #{0}" msgid "Showing posts tagged with #{0}"
msgstr "" msgstr ""
#. placeholder {1}: date.toLocaleString(i18n.locale, { month: 'long', year: 'numeric', }) #. placeholder {1}: date.toLocaleString(i18n.locale, { month: 'long', year: 'numeric', })
#: src/pages/account-statuses.jsx:415 #: src/pages/account-statuses.jsx:411
msgid "Showing posts in {1}" msgid "Showing posts in {1}"
msgstr "Showing posts in {1}" msgstr "Showing posts in {1}"
#: src/pages/account-statuses.jsx:504 #: src/pages/account-statuses.jsx:500
msgid "Nothing to see here yet." msgid "Nothing to see here yet."
msgstr "" msgstr ""
#: src/pages/account-statuses.jsx:505 #: src/pages/account-statuses.jsx:501
#: src/pages/public.jsx:98 #: src/pages/public.jsx:98
#: src/pages/trending.jsx:450 #: src/pages/trending.jsx:450
msgid "Unable to load posts" msgid "Unable to load posts"
msgstr "" msgstr ""
#: src/pages/account-statuses.jsx:546 #: src/pages/account-statuses.jsx:542
#: src/pages/account-statuses.jsx:576 #: src/pages/account-statuses.jsx:572
msgid "Unable to fetch account info" msgid "Unable to fetch account info"
msgstr "" msgstr ""
#. placeholder {0}: accountInstance ? ( <> {' '} (<b>{punycode.toUnicode(accountInstance)}</b>) </> ) : null #. placeholder {0}: accountInstance ? ( <> {' '} (<b>{punycode.toUnicode(accountInstance)}</b>) </> ) : null
#: src/pages/account-statuses.jsx:553 #: src/pages/account-statuses.jsx:549
msgid "Switch to account's instance {0}" msgid "Switch to account's instance {0}"
msgstr "" msgstr ""
#: src/pages/account-statuses.jsx:583 #: src/pages/account-statuses.jsx:579
msgid "Switch to my instance (<0>{currentInstance}</0>)" msgid "Switch to my instance (<0>{currentInstance}</0>)"
msgstr "" msgstr ""
#: src/pages/account-statuses.jsx:645 #: src/pages/account-statuses.jsx:641
msgid "Month" msgid "Month"
msgstr "" msgstr ""

View file

@ -255,12 +255,8 @@ function AccountStatuses() {
} }
useTitle(title, '/:instance?/a/:id'); useTitle(title, '/:instance?/a/:id');
const fetchAccountPromiseRef = useRef();
const fetchAccount = useCallback(() => { const fetchAccount = useCallback(() => {
const fetchPromise = return memFetchAccount(id, masto);
fetchAccountPromiseRef.current || masto.v1.accounts.$select(id).fetch();
fetchAccountPromiseRef.current = fetchPromise;
return fetchPromise;
}, [id, masto]); }, [id, masto]);
useEffect(() => { useEffect(() => {
@ -691,4 +687,11 @@ function MonthPicker(props) {
); );
} }
function fetchAccount(id, masto) {
return masto.v1.accounts.$select(id).fetch();
}
const memFetchAccount = pmem(fetchAccount, {
maxAge: 30 * 60 * 1000, // 30 minutes
});
export default AccountStatuses; export default AccountStatuses;