Skip to content

Commit b916fc7

Browse files
committed
Removed reload in try statement for SessionContextProvider; Removed state for invalidCity for CitySelectField
1 parent b1cb141 commit b916fc7

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

frontend/src/contexts/SessionContext.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ export default function SessionContextProvider({ children }: Props) {
2020
method: "POST",
2121
credentials: "include",
2222
});
23-
// Refresh the page to start fresh
24-
window.location.reload();
2523
} catch (error) {
2624
console.error("Failed to clear session:", error);
2725
// Fallback: just refresh the page

frontend/src/pages/Chat/components/CitySelectField.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,13 @@ interface Props {
3030

3131
export default function CitySelectField({ setMessages }: Props) {
3232
const [city, setCity] = useState<string | null>(null);
33-
const [invalidCity, setInvalidCity] = useState<boolean>(false);
3433
const { initChat } = useMessages();
3534

3635
const handleCityChange = async (key: string | null) => {
3736
setCity(key);
3837
const selectedCity =
3938
CitySelectOptions[key as keyof typeof CitySelectOptions];
4039
if (selectedCity && selectedCity.state) {
41-
setInvalidCity(false);
42-
4340
try {
4441
await initChat({ city: selectedCity.city, state: selectedCity.state });
4542

@@ -56,17 +53,14 @@ export default function CitySelectField({ setMessages }: Props) {
5653
]);
5754
} catch (error) {
5855
console.error("Error initializing session:", error);
59-
setInvalidCity(true);
6056
}
61-
} else {
62-
setInvalidCity(true);
6357
}
6458
};
6559

6660
return (
6761
<div className="flex flex-col gap-2">
6862
<p className="text-center text-[#888] mb-10">
69-
{invalidCity
63+
{city
7064
? "Unfortunately we can only answer questions about tenant rights in Oregon right now."
7165
: "Welcome to Tenant First Aid! I can answer your questions about tenant rights in Oregon. To get started, what city are you located in?"}
7266
</p>

0 commit comments

Comments
 (0)