Filter Popup from Expense Module Persists When Switching to Attendance Module

This commit is contained in:
Kartik Sharma 2025-08-18 17:03:21 +05:30 committed by pramod.mahajan
parent 6fe6d0ea40
commit 6cbab5949c

View File

@ -13,8 +13,7 @@ import { useSelector } from "react-redux";
import moment from "moment";
import { useExpenseFilter } from "../../hooks/useExpense";
import { ExpenseFilterSkeleton } from "./ExpenseSkeleton";
import { useLocation } from "react-router-dom";
const ExpenseFilterPanel = ({ onApply, handleGroupBy }) => {
const selectedProjectId = useSelector((store) => store.localVariables.projectId);
@ -72,6 +71,12 @@ const groupByList = useMemo(() => {
closePanel();
};
// Close popup when navigating to another component
const location = useLocation();
useEffect(() => {
closePanel();
}, [location]);
if (isLoading || isFetching) return <ExpenseFilterSkeleton />;
if(isError && isFetched) return <div>Something went wrong Here- {error.message} </div>
return (