fix: Fix errors raised by ShortName not being strings
This commit is contained in:
parent
99d1a77c15
commit
fb5f675099
@ -63,11 +63,10 @@ export const SearchArea = () => {
|
||||
|
||||
const handleNameInput = async (input: string) => {
|
||||
const searchResults = await searchItem(input, preferedLocale)
|
||||
console.log(searchResults)
|
||||
const options = searchResults?.map((res) => ({
|
||||
id: res.item._id,
|
||||
name: res.locale.Name ? res.locale.Name : res.item._name,
|
||||
shortName: res.locale.ShortName
|
||||
shortName: JSON.stringify(res.locale.ShortName)
|
||||
}))
|
||||
setSelecteOptions(options ? options : [])
|
||||
}
|
||||
@ -184,7 +183,6 @@ export const SearchArea = () => {
|
||||
<li {...props} key={option.id}><Typography>{option.name}</Typography></li>
|
||||
)}
|
||||
filterOptions={(options, state) => options.filter(elt =>{
|
||||
console.log(elt.shortName?.toLocaleLowerCase(), state.inputValue.toLocaleLowerCase(), elt.shortName?.toLocaleLowerCase().includes(state.inputValue.toLocaleLowerCase()))
|
||||
return (elt.name?.toLocaleLowerCase().includes(state.inputValue.toLocaleLowerCase())
|
||||
|| elt.id?.toLocaleLowerCase().includes(state.inputValue.toLocaleLowerCase())
|
||||
|| elt.shortName?.toLocaleLowerCase().includes(state.inputValue.toLocaleLowerCase()))
|
||||
|
@ -58,7 +58,6 @@ export const useGlobalState = create<GlobalState>((set) => ({
|
||||
refreshLocalesList: async () => {
|
||||
const locales = sessionStorage.getItem(SessionStorageKeys.LOCALES);
|
||||
const localesList = locales !== null && locales !== undefined && locales !== 'undefined' ? JSON.parse(locales) : await getLocaleList()
|
||||
console.log(localesList)
|
||||
if (!locales) sessionStorage.setItem(SessionStorageKeys.LOCALES, JSON.stringify(localesList ? localesList : null))
|
||||
set((_state) => ({ localesList: localesList ? localesList : [] }))
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user