From ec68479e98a65e2225a1abebadbf85b583d515a5 Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs <93375423+prafull-opensignlabs@users.noreply.github.com> Date: Tue, 11 Jun 2024 11:32:37 +0530 Subject: [PATCH] fix: Ensure real-time updates to records in reports after actions are performed --- .../src/primitives/GetReportDisplay.js | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/apps/OpenSign/src/primitives/GetReportDisplay.js b/apps/OpenSign/src/primitives/GetReportDisplay.js index 8d599aaac..94b1000bb 100644 --- a/apps/OpenSign/src/primitives/GetReportDisplay.js +++ b/apps/OpenSign/src/primitives/GetReportDisplay.js @@ -54,7 +54,7 @@ const ReportTable = (props) => { const [isLoader, setIsLoader] = useState({}); // const [selectedPublicRole, setSelectedPublicRole] = useState(""); // const [isCelebration, setIsCelebration] = useState(false); - const [currentLists, setCurrentLists] = useState([]); + // const [currentLists, setCurrentLists] = useState([]); // const [isPublic, setIsPublic] = useState({}); // const [isPublicProfile, setIsPublicProfile] = useState({}); // const [publicUserName, setIsPublicUserName] = useState(""); @@ -250,19 +250,20 @@ const ReportTable = (props) => { // Get current list const indexOfLastDoc = currentPage * props.docPerPage; const indexOfFirstDoc = indexOfLastDoc - props.docPerPage; - useEffect(() => { - // `currentLists` is total record render on current page - const currentList = props.List?.slice(indexOfFirstDoc, indexOfLastDoc); - //check public template and save in a object to show public and private template - // setIsPublic( - // currentList.reduce((acc, item) => { - // acc[item.objectId] = item?.IsPublic || false; - // return acc; - // }, {}) - // ); - setCurrentLists(currentList); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [indexOfLastDoc, indexOfFirstDoc]); + const currentList = props.List?.slice(indexOfFirstDoc, indexOfLastDoc); + // useEffect(() => { + // // `currentLists` is total record render on current page + // const currentList = props.List?.slice(indexOfFirstDoc, indexOfLastDoc); + // //check public template and save in a object to show public and private template + // // setIsPublic( + // // currentList.reduce((acc, item) => { + // // acc[item.objectId] = item?.IsPublic || false; + // // return acc; + // // }, {}) + // // ); + // setCurrentLists(currentList); + // // eslint-disable-next-line react-hooks/exhaustive-deps + // }, [indexOfLastDoc, indexOfFirstDoc]); // Change page const paginateFront = () => setCurrentPage(currentPage + 1); @@ -928,7 +929,7 @@ const ReportTable = (props) => { {props.List?.length > 0 && ( <> - {currentLists.map((item, index) => + {currentList.map((item, index) => props.ReportName === "Contactbook" ? ( {props.heading.includes("Sr.No") && (