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,
|
initializeFormState,
|
||||||
log,
|
log,
|
||||||
LogType,
|
LogType,
|
||||||
MOD_DRAFT_CACHE_KEY
|
memoizedNormalizeSearchString,
|
||||||
|
MOD_DRAFT_CACHE_KEY,
|
||||||
|
normalizeSearchString
|
||||||
} from '../utils'
|
} from '../utils'
|
||||||
import { CheckboxField, InputField, InputFieldWithImageUpload } from './Inputs'
|
import { CheckboxField, InputField, InputFieldWithImageUpload } from './Inputs'
|
||||||
import { OriginalAuthor } from './OriginalAuthor'
|
import { OriginalAuthor } from './OriginalAuthor'
|
||||||
@ -975,10 +977,13 @@ const GameDropdown = ({
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const filteredOptions = useMemo(() => {
|
const filteredOptions = useMemo(() => {
|
||||||
if (debouncedSearchTerm === '') return []
|
const normalizedSearchTerm = normalizeSearchString(debouncedSearchTerm)
|
||||||
|
if (normalizedSearchTerm === '') return []
|
||||||
else {
|
else {
|
||||||
return options.filter((option) =>
|
return options.filter((option) =>
|
||||||
option.label.toLowerCase().includes(debouncedSearchTerm.toLowerCase())
|
memoizedNormalizeSearchString(option.label).includes(
|
||||||
|
normalizedSearchTerm.toLowerCase()
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}, [debouncedSearchTerm, options])
|
}, [debouncedSearchTerm, options])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user