Fix directory showing load more button when no more profiles exist (#37465)

This commit is contained in:
Heath Dutton🕴️ authored and GitHub committed 2026-01-15 17:02:17 +00:00
1 parent bc2f8a358f
commit 93f5ed0fce
3 files changed
+15 -7

No files matched your search

+9 -4
View File
@@ -6,15 +6,17 @@ import { createDataLoadingThunk } from 'mastodon/store/typed_functions';
import { fetchRelationships } from './accounts';
import { importFetchedAccounts } from './importer';
const DIRECTORY_FETCH_LIMIT = 20;
export const fetchDirectory = createDataLoadingThunk(
'directory/fetch',
async (params: Parameters<typeof apiGetDirectory>[0]) =>
apiGetDirectory(params),
apiGetDirectory(params, DIRECTORY_FETCH_LIMIT),
(data, { dispatch }) => {
dispatch(importFetchedAccounts(data));
dispatch(fetchRelationships(data.map((x) => x.id)));
return { accounts: data };
return { accounts: data, isLast: data.length < DIRECTORY_FETCH_LIMIT };
},
);
@@ -26,12 +28,15 @@ export const expandDirectory = createDataLoadingThunk(
'items',
]) as ImmutableList<unknown>;
return apiGetDirectory({ ...params, offset: loadedItems.size }, 20);
return apiGetDirectory(
{ ...params, offset: loadedItems.size },
DIRECTORY_FETCH_LIMIT,
);
},
(data, { dispatch }) => {
dispatch(importFetchedAccounts(data));
dispatch(fetchRelationships(data.map((x) => x.id)));
return { accounts: data };
return { accounts: data, isLast: data.length < DIRECTORY_FETCH_LIMIT };
},
);