added reload variable for refreshing update edit activity data
This commit is contained in:
parent
be16c74a94
commit
31b8bd1c7a
@ -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 (
|
||||
<>
|
||||
|
Loading…
x
Reference in New Issue
Block a user