From 99bc0d12cb055c332944d233e1464f5c3c3835e0 Mon Sep 17 00:00:00 2001 From: 0xsysr3ll <31414959+0xSysR3ll@users.noreply.github.com> Date: Mon, 27 Apr 2026 15:09:25 +0200 Subject: [PATCH 1/4] fix(discover): preserve keyword filter input focus after selection --- src/components/Selector/index.tsx | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/components/Selector/index.tsx b/src/components/Selector/index.tsx index 2c459466f8..56894d25cb 100644 --- a/src/components/Selector/index.tsx +++ b/src/components/Selector/index.tsx @@ -297,10 +297,15 @@ export const KeywordSelector = ({ const [defaultDataValue, setDefaultDataValue] = useState< { label: string; value: number }[] | null >(null); + const [selectedValue, setSelectedValue] = useState< + MultiValue | SingleValue | null + >(null); useEffect(() => { const loadDefaultKeywords = async (): Promise => { if (!defaultValue) { + setDefaultDataValue(null); + setSelectedValue(null); return; } @@ -317,16 +322,17 @@ export const KeywordSelector = ({ (keyword): keyword is Keyword => keyword !== null ); - setDefaultDataValue( - validKeywords.map((keyword) => ({ - label: keyword.name, - value: keyword.id, - })) - ); + const nextValue = validKeywords.map((keyword) => ({ + label: keyword.name, + value: keyword.id, + })); + + setDefaultDataValue(nextValue); + setSelectedValue(isMulti ? nextValue : (nextValue[0] ?? null)); }; loadDefaultKeywords(); - }, [defaultValue]); + }, [defaultValue, isMulti]); const loadKeywordOptions = async (inputValue: string) => { const results = await axios.get( @@ -346,7 +352,6 @@ export const KeywordSelector = ({ return ( { + setSelectedValue(value); // eslint-disable-next-line @typescript-eslint/no-explicit-any onChange(value as any); }} From da7cfd4ce151523b8e157cbfabaf18f56693528b Mon Sep 17 00:00:00 2001 From: 0xsysr3ll <31414959+0xSysR3ll@users.noreply.github.com> Date: Mon, 27 Apr 2026 15:18:08 +0200 Subject: [PATCH 2/4] refactor: remove unused defaultDataValue state --- src/components/Selector/index.tsx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/components/Selector/index.tsx b/src/components/Selector/index.tsx index 56894d25cb..b83009d95b 100644 --- a/src/components/Selector/index.tsx +++ b/src/components/Selector/index.tsx @@ -294,9 +294,6 @@ export const KeywordSelector = ({ onChange, }: BaseSelectorMultiProps | BaseSelectorSingleProps) => { const intl = useIntl(); - const [defaultDataValue, setDefaultDataValue] = useState< - { label: string; value: number }[] | null - >(null); const [selectedValue, setSelectedValue] = useState< MultiValue | SingleValue | null >(null); @@ -304,7 +301,6 @@ export const KeywordSelector = ({ useEffect(() => { const loadDefaultKeywords = async (): Promise => { if (!defaultValue) { - setDefaultDataValue(null); setSelectedValue(null); return; } @@ -327,7 +323,6 @@ export const KeywordSelector = ({ value: keyword.id, })); - setDefaultDataValue(nextValue); setSelectedValue(isMulti ? nextValue : (nextValue[0] ?? null)); }; @@ -362,7 +357,6 @@ export const KeywordSelector = ({ ? intl.formatMessage(messages.starttyping) : intl.formatMessage(messages.nooptions) } - defaultValue={defaultDataValue} value={selectedValue} loadOptions={loadKeywordOptions} placeholder={intl.formatMessage(messages.searchKeywords)} From 8997f2fbc0367a214f8c975616e419e3166d3636 Mon Sep 17 00:00:00 2001 From: 0xsysr3ll <31414959+0xSysR3ll@users.noreply.github.com> Date: Mon, 27 Apr 2026 15:59:01 +0200 Subject: [PATCH 3/4] fix: remove null type --- src/components/Selector/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Selector/index.tsx b/src/components/Selector/index.tsx index b83009d95b..5e776b19d0 100644 --- a/src/components/Selector/index.tsx +++ b/src/components/Selector/index.tsx @@ -295,7 +295,7 @@ export const KeywordSelector = ({ }: BaseSelectorMultiProps | BaseSelectorSingleProps) => { const intl = useIntl(); const [selectedValue, setSelectedValue] = useState< - MultiValue | SingleValue | null + MultiValue | SingleValue >(null); useEffect(() => { From 0fd6c5d78850c5de463c379a3e749c07cde6de65 Mon Sep 17 00:00:00 2001 From: 0xsysr3ll <31414959+0xSysR3ll@users.noreply.github.com> Date: Thu, 21 May 2026 11:38:14 +0200 Subject: [PATCH 4/4] revert: bring back null Co-authored-by: Ludovic Ortega --- src/components/Selector/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Selector/index.tsx b/src/components/Selector/index.tsx index 5e776b19d0..b83009d95b 100644 --- a/src/components/Selector/index.tsx +++ b/src/components/Selector/index.tsx @@ -295,7 +295,7 @@ export const KeywordSelector = ({ }: BaseSelectorMultiProps | BaseSelectorSingleProps) => { const intl = useIntl(); const [selectedValue, setSelectedValue] = useState< - MultiValue | SingleValue + MultiValue | SingleValue | null >(null); useEffect(() => {