project switch error bug fixed

This commit is contained in:
2025-09-04 14:10:35 +05:30
parent 8271e3c6ce
commit 1d7b3b974d
4 changed files with 15 additions and 6 deletions

View File

@@ -77,7 +77,7 @@ const DashboardCard: React.FC<DashBoardCardProps> = ({
setLoadingProgress(1);
setProjectName(projectName);
navigate(`/projects/${projectId}`);
} catch {}
} catch { }
};
const handleOptionClick = async (option: string) => {
@@ -108,7 +108,7 @@ const DashboardCard: React.FC<DashBoardCardProps> = ({
setProjectName(projectName);
setIsKebabOpen(false);
}
} catch (error) {}
} catch (error) { }
window.open(`/projects/${projectId}`, "_blank");
break;
case "rename":
@@ -179,7 +179,7 @@ const DashboardCard: React.FC<DashBoardCardProps> = ({
if (projectSocket) {
projectSocket.emit("v1:project:update", updateProjects);
}
} catch (error) {}
} catch (error) { }
};
function getRelativeTime(dateString: string): string {
@@ -227,7 +227,7 @@ const DashboardCard: React.FC<DashBoardCardProps> = ({
className="dashboard-card-container"
onClick={navigateToProject}
title={projectName}
// onMouseLeave={() => setIsKebabOpen(false)}
// onMouseLeave={() => setIsKebabOpen(false)}
>
<div className="dashboard-card-wrapper">
<div className="preview-container">
@@ -302,7 +302,7 @@ const DashboardCard: React.FC<DashBoardCardProps> = ({
zIndex: 9999,
top: kebabRef.current
? kebabRef.current.getBoundingClientRect().bottom +
window.scrollY
window.scrollY
: 0,
left: kebabRef.current
? kebabRef.current.getBoundingClientRect().left + window.scrollX

View File

@@ -33,6 +33,7 @@ import { useVersionContext } from "../../../modules/builder/version/versionConte
import { useBuilderStore } from "../../../store/builder/useBuilderStore";
import { recentlyViewed } from "../../../services/dashboard/recentlyViewed";
import { getUserData } from "../../../functions/getUserData";
import useRestStates from "../../../hooks/useResetStates";
function MainScene() {
const { setMainProduct } = useMainProduct();
@@ -60,6 +61,13 @@ function MainScene() {
const { selectedVersionStore } = useVersionContext();
const { selectedVersion, setSelectedVersion } = selectedVersionStore();
const { selectedComment, commentPositionState } = useSelectedComment();
const { resetStates } = useRestStates();
useEffect(() => {
return () => {
resetStates();
}
}, [])
useEffect(() => {
if (activeModule !== 'simulation') {

View File

@@ -5,8 +5,8 @@ import { useVersionHistoryStore } from "../store/builder/useVersionHistoryStore"
const useRestStates = () => {
const { selectedVersionStore } = useVersionContext();
const { clearSelectedVersion } = selectedVersionStore();
const { selectedProductStore } = useProductContext();
const { clearSelectedVersion } = selectedVersionStore();
const { clearSelectedProduct } = selectedProductStore();
const { clearVersions } = useVersionHistoryStore();
const { clearStores } = useSceneContext();

View File

@@ -61,6 +61,7 @@ const Project: React.FC = () => {
};
fetchProjects();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);