fix: PaginatedList does not always load more (#4811)

This commit is contained in:
Tom Moor
2023-01-30 19:53:14 -08:00
committed by GitHub
parent 65a4874301
commit f39487d25b
3 changed files with 7 additions and 6 deletions

View File

@@ -99,7 +99,7 @@ class PaginatedList<T extends PaginatedItem> extends React.Component<Props<T>> {
}
this.isFetching = true;
const counter = ++this.fetchCounter;
const limit = DEFAULT_PAGINATION_LIMIT;
const limit = this.props.options?.limit ?? DEFAULT_PAGINATION_LIMIT;
this.error = undefined;
try {

View File

@@ -43,15 +43,13 @@ function Collections() {
}),
});
React.useEffect(() => {
collections.fetchPage({ limit: 100 });
}, [collections]);
return (
<Flex column>
<Header id="collections" title={t("Collections")}>
<Relative>
<PaginatedList
fetch={collections.fetchPage}
options={{ limit: 25 }}
aria-label={t("Collections")}
items={collections.orderedData}
loading={<PlaceholderCollections />}

View File

@@ -760,7 +760,10 @@ router.post(
method: ["withMembership", user.id],
}).findAll({
where,
order: [["updatedAt", "DESC"]],
order: [
Sequelize.literal('"collection"."index" collate "C"'),
["updatedAt", "DESC"],
],
offset: ctx.state.pagination.offset,
limit: ctx.state.pagination.limit,
});