File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
frontend/src/pages/Chat/components Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -30,14 +30,14 @@ interface Props {
30
30
31
31
export default function CitySelectField ( { setMessages } : Props ) {
32
32
const [ city , setCity ] = useState < string | null > ( null ) ;
33
- let invalidCity : boolean = false ;
33
+ let [ invalidCity , setInvalidCity ] = useState < boolean > ( false ) ;
34
34
const { initChat } = useMessages ( ) ;
35
35
36
36
const handleCityChange = async ( key : string | null ) => {
37
37
setCity ( key ) ;
38
38
const selectedCity = CitySelectOptions [ key as keyof typeof CitySelectOptions ] ;
39
39
if ( selectedCity && selectedCity . state ) {
40
- invalidCity = false ; // Reset invalid city state
40
+ setInvalidCity ( false ) ;
41
41
42
42
try {
43
43
await initChat ( { city : selectedCity . city , state : selectedCity . state } ) ;
@@ -54,10 +54,10 @@ export default function CitySelectField({ setMessages }: Props) {
54
54
] ) ;
55
55
} catch ( error ) {
56
56
console . error ( "Error initializing session:" , error ) ;
57
- invalidCity = true ;
57
+ setInvalidCity ( true ) ;
58
58
}
59
59
} else {
60
- invalidCity = true ;
60
+ setInvalidCity ( true ) ;
61
61
}
62
62
} ;
63
63
You can’t perform that action at this time.
0 commit comments