diff --git a/src/components/Project/ProjectInfra.jsx b/src/components/Project/ProjectInfra.jsx index be8237db..9841f014 100644 --- a/src/components/Project/ProjectInfra.jsx +++ b/src/components/Project/ProjectInfra.jsx @@ -14,12 +14,16 @@ import { MANAGE_PROJECT_INFRA } from "../../utils/constants"; import InfraTable from "./Infrastructure/InfraTable"; import { cacheData, clearCacheKey, getCachedData } from "../../slices/apiDataManager"; import { useProjectDetails } from "../../hooks/useProjects"; +import {useDispatch, useSelector} from "react-redux"; +import {refreshData} from "../../slices/localVariablesSlice"; const ProjectInfra = ({ data, onDataChange, eachSiteEngineer, -}) => { +} ) => +{ + const reloadedData = useSelector((store)=>store.localVariables.reload) const [expandedBuildings, setExpandedBuildings] = useState([]); const { projects_Details,refetch, loading } = useProjectDetails(data?.id); const [project, setProject] = useState(projects_Details); @@ -35,7 +39,8 @@ const ProjectInfra = ({ const [isCreateModalOpen, setIsCreateModalOpen] = useState(false); const [clearFormTrigger, setClearFormTrigger] = useState(false); const [CurrentBuilding, setCurrentBuilding] = useState(""); - const [showModal, setShowModal] = useState(false); + const [ showModal, setShowModal ] = useState( false ); + const dispatch = useDispatch() useEffect(() => { setProject(projects_Details); @@ -339,7 +344,15 @@ const ProjectInfra = ({ }; const handleShow = () => setShowModal(true); - const handleClose = () => setShowModal(false); + const handleClose = () => setShowModal( false ); + useEffect( () => + { + if (reloadedData) + { + refetch() + dispatch( refreshData( false ) ) + } + },[reloadedData]) return ( <>