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; this.isFetching = true;
const counter = ++this.fetchCounter; const counter = ++this.fetchCounter;
const limit = DEFAULT_PAGINATION_LIMIT; const limit = this.props.options?.limit ?? DEFAULT_PAGINATION_LIMIT;
this.error = undefined; this.error = undefined;
try { try {

View File

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

View File

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