fix(search): apply games search autocomplete in mod-submit
All checks were successful
Release to Staging / build_and_release (push) Successful in 1m7s
All checks were successful
Release to Staging / build_and_release (push) Successful in 1m7s
This commit is contained in:
parent
0f16de1750
commit
ccc5de0006
@ -29,7 +29,9 @@ import {
|
||||
initializeFormState,
|
||||
log,
|
||||
LogType,
|
||||
MOD_DRAFT_CACHE_KEY
|
||||
memoizedNormalizeSearchString,
|
||||
MOD_DRAFT_CACHE_KEY,
|
||||
normalizeSearchString
|
||||
} from '../utils'
|
||||
import { CheckboxField, InputField, InputFieldWithImageUpload } from './Inputs'
|
||||
import { OriginalAuthor } from './OriginalAuthor'
|
||||
@ -975,10 +977,13 @@ const GameDropdown = ({
|
||||
}, [])
|
||||
|
||||
const filteredOptions = useMemo(() => {
|
||||
if (debouncedSearchTerm === '') return []
|
||||
const normalizedSearchTerm = normalizeSearchString(debouncedSearchTerm)
|
||||
if (normalizedSearchTerm === '') return []
|
||||
else {
|
||||
return options.filter((option) =>
|
||||
option.label.toLowerCase().includes(debouncedSearchTerm.toLowerCase())
|
||||
memoizedNormalizeSearchString(option.label).includes(
|
||||
normalizedSearchTerm.toLowerCase()
|
||||
)
|
||||
)
|
||||
}
|
||||
}, [debouncedSearchTerm, options])
|
||||
|
Loading…
x
Reference in New Issue
Block a user