From 57b03936ebfb84cb69a9d86a1dbe955f7ecfb82e Mon Sep 17 00:00:00 2001 From: CuriousCorrelation Date: Sun, 10 Jul 2022 19:59:09 +0530 Subject: [PATCH] Change `PaginatedDropdown` to consume user store `PaginatedDropdown` should consume user store directly, so the pagination and refresh can be encapsulated into one single component. TODO: Impl memoized options calculation for `PaginatedDropdown` --- app/scenes/Search/components/UserFilter.tsx | 22 +-------------------- shared/i18n/locales/en_US/translation.json | 2 +- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/app/scenes/Search/components/UserFilter.tsx b/app/scenes/Search/components/UserFilter.tsx index 3c238f65b5..cb5e2cce19 100644 --- a/app/scenes/Search/components/UserFilter.tsx +++ b/app/scenes/Search/components/UserFilter.tsx @@ -14,31 +14,11 @@ function UserFilter(props: Props) { const { t } = useTranslation(); const { users } = useStores(); - React.useEffect(() => { - users.fetchPage({ - limit: 100, - }); - }, [users]); - - const options = React.useMemo(() => { - const userOptions = users.all.map((user) => ({ - key: user.id, - label: user.name, - })); - return [ - { - key: "", - label: t("Any author"), - }, - ...userOptions, - ]; - }, [users.all, t]); - return ( diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json index a12e690e6c..816f117e7b 100644 --- a/shared/i18n/locales/en_US/translation.json +++ b/shared/i18n/locales/en_US/translation.json @@ -150,6 +150,7 @@ "Dismiss": "Dismiss", "Back": "Back", "Documents": "Documents", + "Any author": "Any author", "Results": "Results", "No results for {{query}}": "No results for {{query}}", "Logo": "Logo", @@ -543,7 +544,6 @@ "Documents in collections you are able to access": "Documents in collections you are able to access", "All documents": "All documents", "Include documents that are in the archive": "Include documents that are in the archive", - "Any author": "Any author", "Author": "Author", "We were unable to find the page you’re looking for.": "We were unable to find the page you’re looking for.", "No documents found for your search filters.": "No documents found for your search filters.",