Merge branch 'home-link-headers' into 'develop'

Use Link header for home timeline pagination

See merge request soapbox-pub/soapbox!2395
This commit is contained in:
Alex Gleason
2023-04-12 13:05:46 +00:00
5 changed files with 74 additions and 15 deletions

View File

@ -30,7 +30,7 @@ const CarouselItem = React.forwardRef((
setLoading(true);
if (isSelected) {
dispatch(replaceHomeTimeline(null, { maxId: null }, () => setLoading(false)));
dispatch(replaceHomeTimeline(undefined, { maxId: null }, () => setLoading(false)));
if (onPinned) {
onPinned(null);

View File

@ -27,9 +27,10 @@ const HomeTimeline: React.FC = () => {
const isPartial = useAppSelector(state => state.timelines.get('home')?.isPartial === true);
const currentAccountId = useAppSelector(state => state.timelines.get('home')?.feedAccountId as string | undefined);
const currentAccountRelationship = useAppSelector(state => currentAccountId ? state.relationships.get(currentAccountId) : null);
const next = useAppSelector(state => state.timelines.get('home')?.next);
const handleLoadMore = (maxId: string) => {
dispatch(expandHomeTimeline({ maxId, accountId: currentAccountId }));
dispatch(expandHomeTimeline({ url: next, maxId, accountId: currentAccountId }));
};
// Mastodon generates the feed in Redis, and can return a partial timeline
@ -52,7 +53,7 @@ const HomeTimeline: React.FC = () => {
};
const handleRefresh = () => {
return dispatch(expandHomeTimeline({ maxId: null, accountId: currentAccountId }));
return dispatch(expandHomeTimeline({ accountId: currentAccountId }));
};
useEffect(() => {

View File

@ -35,7 +35,7 @@ const TestTimeline: React.FC = () => {
React.useEffect(() => {
dispatch(importFetchedStatuses(MOCK_STATUSES));
dispatch(expandTimelineSuccess(timelineId, MOCK_STATUSES, null, false, false, false));
dispatch(expandTimelineSuccess(timelineId, MOCK_STATUSES, undefined, undefined, false, false, false));
}, []);
return (