diff --git a/src/Components/Auth/Login.tsx b/src/Components/Auth/Login.tsx index 58472c4ff25..4aad207c25a 100644 --- a/src/Components/Auth/Login.tsx +++ b/src/Components/Auth/Login.tsx @@ -12,7 +12,7 @@ import CircularProgress from "../Common/components/CircularProgress"; import { LocalStorageKeys } from "../../Common/constants"; import ReactMarkdown from "react-markdown"; import rehypeRaw from "rehype-raw"; -import { handleRedirection } from "../../Utils/utils"; +import { handleRedirection, invalidateFiltersCache } from "../../Utils/utils"; export const Login = (props: { forgot?: boolean }) => { const { @@ -91,6 +91,7 @@ export const Login = (props: { forgot?: boolean }) => { const handleSubmit = async (e: any) => { e.preventDefault(); + invalidateFiltersCache(); const valid = validateData(); if (valid) { // replaces button with spinner diff --git a/src/Utils/utils.ts b/src/Utils/utils.ts index 7e34d027020..4c4fdacbc28 100644 --- a/src/Utils/utils.ts +++ b/src/Utils/utils.ts @@ -459,3 +459,11 @@ export const scrollTo = (id: string | boolean) => { const element = document.querySelector(`#${id}`); element?.scrollIntoView({ behavior: "smooth", block: "center" }); }; + +export const invalidateFiltersCache = () => { + for (const key in localStorage) { + if (key.startsWith("filters--")) { + localStorage.removeItem(key); + } + } +};