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 78a50f6db4
commit ad10a5b66b

View File

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