fix: apply theme and locale changes immediately on login screen (#5440) (#5442)

This commit is contained in:
Om vataliya 2026-01-07 19:28:47 +05:30 committed by GitHub
parent 7c3fcc297d
commit 013ea52519
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -2,7 +2,7 @@ import { GlobeIcon } from "lucide-react";
import { FC } from "react";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { locales } from "@/i18n";
import { getLocaleDisplayName } from "@/utils/i18n";
import { getLocaleDisplayName, loadLocale } from "@/utils/i18n";
interface Props {
value: Locale;
@ -13,6 +13,9 @@ const LocaleSelect: FC<Props> = (props: Props) => {
const { onChange, value } = props;
const handleSelectChange = async (locale: Locale) => {
// Apply locale globally immediately
loadLocale(locale);
// Also notify parent component
onChange(locale);
};

View File

@ -1,6 +1,6 @@
import { Monitor, Moon, MoonStar, Palette, Sun, Wallpaper } from "lucide-react";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { THEME_OPTIONS } from "@/utils/theme";
import { loadTheme, THEME_OPTIONS } from "@/utils/theme";
interface ThemeSelectProps {
value?: string;
@ -21,6 +21,9 @@ const ThemeSelect = ({ value, onValueChange, className }: ThemeSelectProps = {})
const currentTheme = value || "system";
const handleThemeChange = (newTheme: string) => {
// Apply theme globally immediately
loadTheme(newTheme);
// Also notify parent component if callback is provided
if (onValueChange) {
onValueChange(newTheme);
}