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