Remove test intermediate paginateFetch proxy fn

This commit is contained in:
CuriousCorrelation authored and Tom Moor committed 2022-07-17 12:22:25 +01:00
1 parent efc891d22a
commit e1f6fbab7f
2 files changed
+2 -16

No files matched your search

+1 -1
View File
@@ -26,7 +26,7 @@ type Props = {
searchable?: boolean;
paginateFetch?: (
options: PaginatedItem
) => Promise<TFilterOption[] | undefined>;
) => Promise<PaginatedItem[] | undefined>;
};
const FilterOptions = ({
+1 -15
View File
@@ -1,9 +1,7 @@
import { observer } from "mobx-react";
import * as React from "react";
import { useTranslation } from "react-i18next";
import User from "~/models/User";
import FilterOptions from "~/components/FilterOptions";
import { PaginatedItem } from "~/components/PaginatedList";
import useStores from "~/hooks/useStores";
type Props = {
@@ -38,18 +36,6 @@ function UserFilter(props: Props) {
];
}, [users.all, t]);
const paginateFetch = React.useCallback(
async (options: PaginatedItem) => {
const list = await users.fetchPage(options);
return list.map((user: User) => ({
key: user.id,
id: user.id,
label: user.name,
}));
},
[users]
);
return (
<FilterOptions
options={options}
@@ -58,7 +44,7 @@ function UserFilter(props: Props) {
defaultLabel={t("Any author")}
selectedPrefix={`${t("Author")}:`}
searchable
paginateFetch={paginateFetch}
paginateFetch={users.fetchPage}
/>
);
}