pl-fe: timeline load more fix
Signed-off-by: Nicole Mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -29,6 +29,7 @@ const AccountGallery = () => {
|
||||
const attachments: Array<AccountGalleryAttachment> = 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) {
|
||||
@ -59,7 +60,7 @@ const AccountGallery = () => {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (account) {
|
||||
if (account && !afterInitialLoad) {
|
||||
dispatch(fetchAccountTimeline(account.id, { only_media: true, limit: 40 }));
|
||||
}
|
||||
}, [account?.id]);
|
||||
|
||||
@ -36,6 +36,7 @@ interface Timeline {
|
||||
totalQueuedItemsCount: number; //used for queuedItems overflow for MAX_QUEUED_ITEMS+
|
||||
loadingFailed: boolean;
|
||||
isPartial: boolean;
|
||||
loaded: boolean;
|
||||
}
|
||||
|
||||
const newTimeline = (): Timeline => ({
|
||||
@ -50,6 +51,7 @@ const newTimeline = (): Timeline => ({
|
||||
totalQueuedItemsCount: 0, //used for queuedItems overflow for MAX_QUEUED_ITEMS+
|
||||
loadingFailed: false,
|
||||
isPartial: false,
|
||||
loaded: false,
|
||||
});
|
||||
|
||||
const initialState: State = {};
|
||||
@ -105,6 +107,7 @@ const expandNormalizedTimeline = (
|
||||
timeline.isPartial = isPartial;
|
||||
timeline.next = next;
|
||||
timeline.prev = prev;
|
||||
timeline.loaded = true;
|
||||
|
||||
if (!next && !isLoadingRecent) timeline.hasMore = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user