Skip to content

Commit

Permalink
Make select tag works properly
Browse files Browse the repository at this point in the history
  • Loading branch information
bclswl0827 committed Feb 12, 2024
1 parent 79bf04d commit 1cea7b6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const Sidebar = (props: SidebarProps) => {
} = props;
const navigate = useNavigate();

const [checkedLocale, setCheckedLocale] = useState(currentLocale);
const [renamingChatTitle, setRenamingChatTitle] = useState<{
id: string;
title: string;
Expand Down Expand Up @@ -109,6 +110,7 @@ export const Sidebar = (props: SidebarProps) => {
label: t("components.Sidebar.earlier_label"),
},
});
setCheckedLocale(currentLocale);
}, [t, currentLocale, sessions]);

return (
Expand Down Expand Up @@ -292,7 +294,7 @@ export const Sidebar = (props: SidebarProps) => {
<select
className="text-gray-300/50 text-center bg-transparent w-full"
onChange={({ target }) => onSwitchLocale(target.value)}
defaultValue={currentLocale}
defaultValue={checkedLocale}
>
<option disabled>Choose Language</option>
{Object.entries(locales).map(([key, value]) => (
Expand Down

0 comments on commit 1cea7b6

Please sign in to comment.