forked from VinokurovVE/tests
Remove spread fill to avoid duplicate values on autocomplete
This commit is contained in:
@ -10,7 +10,6 @@ import { mutate } from "swr"
|
||||
export default function Reports() {
|
||||
const [download, setDownload] = useState(false)
|
||||
|
||||
const [options, setOptions] = useState<ICity[]>([])
|
||||
const [search, setSearch] = useState<string | null>("")
|
||||
const debouncedSearch = useDebounce(search, 500)
|
||||
const [selectedOption, setSelectedOption] = useState<ICity | null>(null)
|
||||
@ -20,12 +19,6 @@ export default function Reports() {
|
||||
|
||||
const { reportExported } = useReportExport(selectedOption?.id, download)
|
||||
|
||||
useEffect(() => {
|
||||
if (cities) {
|
||||
setOptions([...cities])
|
||||
}
|
||||
}, [cities])
|
||||
|
||||
const refreshReport = async () => {
|
||||
mutate(`/info/reports/${selectedOption?.id}?to_export=false`)
|
||||
}
|
||||
@ -57,7 +50,7 @@ export default function Reports() {
|
||||
onChange={(_, value) => setSelectedOption(value)}
|
||||
isOptionEqualToValue={(option: ICity, value: ICity) => option.id === value.id}
|
||||
getOptionLabel={(option: ICity) => option.name ? option.name : ""}
|
||||
options={options}
|
||||
options={cities || []}
|
||||
loading={isLoading}
|
||||
value={selectedOption}
|
||||
renderInput={(params) => (
|
||||
|
Reference in New Issue
Block a user