diff --git a/packages/pl-fe/src/actions/timelines.ts b/packages/pl-fe/src/actions/timelines.ts index 5c7513ac7..25ba4e74e 100644 --- a/packages/pl-fe/src/actions/timelines.ts +++ b/packages/pl-fe/src/actions/timelines.ts @@ -236,6 +236,7 @@ const fetchAccountTimeline = (accountId: string, { exclude_replies, pinned, only if (pinned || only_media) params.with_muted = true; if (useSettingsStore.getState().settings.autoTranslate) params.language = getLocale(); + if (!expand && state.timelines[timelineId]?.loaded) return; if (expand && state.timelines[timelineId]?.isLoading) return; const fn = (expand && state.timelines[timelineId]?.next?.()) || getClient(state).accounts.getAccountStatuses(accountId, params); diff --git a/packages/pl-fe/src/features/account-gallery/index.tsx b/packages/pl-fe/src/features/account-gallery/index.tsx index fe4840ab7..6925548d9 100644 --- a/packages/pl-fe/src/features/account-gallery/index.tsx +++ b/packages/pl-fe/src/features/account-gallery/index.tsx @@ -29,7 +29,6 @@ const AccountGallery = () => { const attachments: Array = useAppSelector((state) => account ? getAccountGallery(state, account.id) : []); const isLoading = useAppSelector((state) => state.timelines[`account:${account?.id}:with_replies:media`]?.isLoading); const hasMore = useAppSelector((state) => state.timelines[`account:${account?.id}:with_replies:media`]?.hasMore); - const afterInitialLoad = useAppSelector((state) => state.timelines[`account:${account?.id}:with_replies:media`]?.loaded); const handleScrollToBottom = () => { if (hasMore) { @@ -60,7 +59,7 @@ const AccountGallery = () => { }; useEffect(() => { - if (account && !afterInitialLoad) { + if (account) { dispatch(fetchAccountTimeline(account.id, { only_media: true, limit: 40 })); } }, [account?.id]); diff --git a/packages/pl-fe/src/features/account-timeline/index.tsx b/packages/pl-fe/src/features/account-timeline/index.tsx index 3f9bbf8cf..f46558aa9 100644 --- a/packages/pl-fe/src/features/account-timeline/index.tsx +++ b/packages/pl-fe/src/features/account-timeline/index.tsx @@ -52,15 +52,13 @@ const AccountTimeline: React.FC = ({ params, withReplies = fal .catch(() => setAccountLoading(false)); }, [params.username]); - useEffect(() => { - if (account && !withReplies) { - dispatch(fetchAccountTimeline(account.id, { pinned: true })); - } - }, [account?.id, withReplies]); - useEffect(() => { if (account) { dispatch(fetchAccountTimeline(account.id, { exclude_replies: !withReplies })); + + if (!withReplies) { + dispatch(fetchAccountTimeline(account.id, { pinned: true })); + } } }, [account?.id, withReplies]);