diff --git a/src/pages/account-statuses.jsx b/src/pages/account-statuses.jsx
index 476dd0f7..eb530854 100644
--- a/src/pages/account-statuses.jsx
+++ b/src/pages/account-statuses.jsx
@@ -1,5 +1,11 @@
import { MenuItem } from '@szhsin/react-menu';
-import { useEffect, useMemo, useRef, useState } from 'preact/hooks';
+import {
+ useCallback,
+ useEffect,
+ useMemo,
+ useRef,
+ useState,
+} from 'preact/hooks';
import { useParams, useSearchParams } from 'react-router-dom';
import { useSnapshot } from 'valtio';
@@ -217,10 +223,19 @@ function AccountStatuses() {
: 'Account posts',
'/:instance?/a/:id',
);
+
+ const fetchAccountPromiseRef = useRef();
+ const fetchAccount = useCallback(() => {
+ const fetchPromise =
+ fetchAccountPromiseRef.current || masto.v1.accounts.$select(id).fetch();
+ fetchAccountPromiseRef.current = fetchPromise;
+ return fetchPromise;
+ }, [id, masto]);
+
useEffect(() => {
(async () => {
try {
- const acc = await masto.v1.accounts.$select(id).fetch();
+ const acc = await fetchAccount();
console.log(acc);
setAccount(acc);
} catch (e) {
@@ -240,20 +255,27 @@ function AccountStatuses() {
const { displayName, acct, emojis } = account || {};
+ const accountInfoMemo = useMemo(() => {
+ const cachedAccount = snapStates.accounts[`${id}@${instance}`];
+ return (
+
+ );
+ }, [id, instance, authenticated, fetchAccount]);
+
const filterBarRef = useRef();
const TimelineStart = useMemo(() => {
- const cachedAccount = snapStates.accounts[`${id}@${instance}`];
const filtered =
!excludeReplies || excludeBoosts || tagged || media || !!month;
+
return (
<>
- masto.v1.accounts.$select(id).fetch()}
- authenticated={authenticated}
- standalone
- />
+ {accountInfoMemo}
{filtered ? (