In ProjectNav bar last selected tab will be shown when we refresh the page.

This commit is contained in:
Kartik Sharma 2025-07-30 13:18:20 +05:30
parent 94962ef7a6
commit 6c571e62da

View File

@ -47,9 +47,10 @@ const ProjectDetails = () => {
refetch,
} = useProjectDetails(projectId);
const [activePill, setActivePill] = useState("profile");
// const [activePill, setActivePill] = useState("profile");
const [activePill, setActivePill] = useState(() => {
return localStorage.getItem("lastActiveProjectTab") || "profile";
});
const handler = useCallback(
(msg) => {
@ -65,9 +66,11 @@ const ProjectDetails = () => {
return () => eventBus.off("project", handler);
}, [handler]);
const handlePillClick = (pillKey) => {
setActivePill(pillKey);
};
const handlePillClick = (pillKey) => {
setActivePill(pillKey);
localStorage.setItem("lastActiveProjectTab", pillKey); // Save to localStorage
};
const renderContent = () => {
if (projectLoading || !projects_Details) return <Loader />;