From cf7ad598dbffe54d4db60795b64d50e38c81396b Mon Sep 17 00:00:00 2001 From: Pierre Hubert Date: Sat, 26 Aug 2023 08:00:29 +0200 Subject: [PATCH] Limit the number of choices in member input --- geneit_app/src/widgets/forms/MemberInput.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/geneit_app/src/widgets/forms/MemberInput.tsx b/geneit_app/src/widgets/forms/MemberInput.tsx index 9a95ab9..03ea5a1 100644 --- a/geneit_app/src/widgets/forms/MemberInput.tsx +++ b/geneit_app/src/widgets/forms/MemberInput.tsx @@ -65,11 +65,13 @@ export function MemberInput(p: { }} options={choices} sx={{ width: "100%" }} - filterOptions={(options, state) => - options.filter((m) => + filterOptions={(options, state) => { + const res = options.filter((m) => m?.fullName.toLowerCase().includes(state.inputValue) - ) - } + ); + res.length = Math.min(15, res.length); + return res; + }} getOptionLabel={(o) => o?.fullName ?? ""} renderInput={(params) => } renderOption={(_props, option, _state) => (