Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(web): invalidate session after locale updates

Tin2566f3eed680
diff --git a/apps/web/src/hooks/use-locale.ts b/apps/web/src/hooks/use-locale.ts
index 50faa422e..dbde07745 100644
--- a/apps/web/src/hooks/use-locale.ts
+++ b/apps/web/src/hooks/use-locale.ts
@@ -1,3 +1,4 @@
+import { useQueryClient } from "@tanstack/react-query";
import { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { authClient } from "@/lib/auth-client";
@@ -5,6 +6,7 @@ import { getBrowserLocale, resolveLocale } from "@/lib/i18n";
export function useLocale() {
const { i18n } = useTranslation();
+ const queryClient = useQueryClient();
const locale = useMemo(
() => resolveLocale(i18n.resolvedLanguage, getBrowserLocale()),
@@ -17,6 +19,7 @@ export function useLocale() {
throw new Error(error.message || "Failed to update locale");
}
+ await queryClient.invalidateQueries({ queryKey: ["session"] });
await i18n.changeLanguage(resolveLocale(nextLocale, null));
};