fix: cursor resetting in dropdown causing wrong query selection (#5063)

This commit is contained in:
Vikrant Gupta 2024-05-23 22:43:11 +05:30 committed by GitHub
parent 93babc3019
commit da74619a46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View File

@ -126,6 +126,7 @@ export const useAutoComplete = (
isExist, isExist,
results, results,
result, result,
isFetching,
whereClauseConfig, whereClauseConfig,
); );

View File

@ -23,6 +23,7 @@ export const useOptions = (
isExist: boolean, isExist: boolean,
results: string[], results: string[],
result: string[], result: string[],
isFetching: boolean,
whereClauseConfig?: WhereClauseConfig, whereClauseConfig?: WhereClauseConfig,
): Option[] => { ): Option[] => {
const [options, setOptions] = useState<Option[]>([]); const [options, setOptions] = useState<Option[]>([]);
@ -138,6 +139,9 @@ export const useOptions = (
if (newOptions.length > 0) { if (newOptions.length > 0) {
setOptions(newOptions); setOptions(newOptions);
} }
if (isFetching) {
setOptions([]);
}
}, [ }, [
whereClauseConfig, whereClauseConfig,
getKeyOpValue, getKeyOpValue,
@ -154,6 +158,7 @@ export const useOptions = (
searchValue, searchValue,
getKeyOperatorOptions, getKeyOperatorOptions,
getOptionsWithValidOperator, getOptionsWithValidOperator,
isFetching,
]); ]);
return useMemo( return useMemo(