From 3becb00102edccf71235db5fed887ef2e57eeddb Mon Sep 17 00:00:00 2001 From: CuriousCorrelation Date: Sun, 10 Jul 2022 21:01:47 +0530 Subject: [PATCH] Use `user.id` as `PaginatedItem` `id` --- app/components/PaginatedDropdown.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/components/PaginatedDropdown.tsx b/app/components/PaginatedDropdown.tsx index 914493a400..072a3b8718 100644 --- a/app/components/PaginatedDropdown.tsx +++ b/app/components/PaginatedDropdown.tsx @@ -8,10 +8,10 @@ import ContextMenu from "~/components/ContextMenu"; import MenuItem from "~/components/ContextMenu/MenuItem"; import Text from "~/components/Text"; import InputSearch from "./InputSearch"; -import PaginatedList from "./PaginatedList"; +import PaginatedList, { PaginatedItem } from "./PaginatedList"; -type TFilterOption = { - key: string; +type TFilterOption = PaginatedItem & { + id: string; label: string; note?: string; }; @@ -39,12 +39,12 @@ const PaginatedDropdown = ({ }); const options = React.useMemo(() => { const userOptions = users.all.map((user: User) => ({ - key: user.id, + id: user.id, label: user.name, })); return [ { - key: "", + id: "", label: t("Any author"), }, ...userOptions, @@ -102,12 +102,12 @@ const PaginatedDropdown = ({ fetch={users.fetchPage} renderItem={(user: TFilterOption) => ( { - onSelect(user.key); + onSelect(user.id); menu.hide(); }} - selected={user.key === activeKey} + selected={user.id === activeKey} {...menu} > {user.note ? (