From 33430a85459cfbbd99642118aed809f0db7f9421 Mon Sep 17 00:00:00 2001 From: sagarika-padmanaban Date: Wed, 4 Sep 2024 11:32:38 +0530 Subject: [PATCH] issue in ta fixed --- src/ui/pages/component/common/Header.jsx | 9 +++++++++ .../Progress/MetaAnalytics/MetaAnalytics.jsx | 16 ++++++++++++---- .../Progress/TaskAnalytics/TaskAnalytics.jsx | 17 ++++++++++++----- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/ui/pages/component/common/Header.jsx b/src/ui/pages/component/common/Header.jsx index 10cdcf70..2c080cc7 100644 --- a/src/ui/pages/component/common/Header.jsx +++ b/src/ui/pages/component/common/Header.jsx @@ -52,6 +52,8 @@ import CustomizedSnackbars from "../common/Snackbar"; import userRole from "../../../../utils/UserMappedByRole/Roles"; import NotificationAPI from "../../../../redux/actions/api/Notification/Notification"; import UpdateUIPrefsAPI from "../../../../redux/actions/api/UserManagement/UpdateUIPrefs"; +import TaskAnalyticsDataAPI from "../../../../redux/actions/api/Progress/TaskAnalytics"; +import MetaAnalyticsDataAPI from "../../../../redux/actions/api/Progress/MetaAnalytics"; const Header = () => { const [anchorElUser, setAnchorElUser] = useState(null); @@ -169,7 +171,14 @@ const Header = () => { getLoggedInUserData(); }, []); + useEffect(() => { + const userObj = new TaskAnalyticsDataAPI('ContextualTranslationEditing'); + dispatch(APITransport(userObj)); + const userObj1 = new MetaAnalyticsDataAPI(1,'ContextualTranslationEditing'); + dispatch(APITransport(userObj1)); + + }, []); /* useEffect(()=>{ if(loggedInUserData?.prefer_cl_ui !== undefined){ diff --git a/src/ui/pages/container/Progress/MetaAnalytics/MetaAnalytics.jsx b/src/ui/pages/container/Progress/MetaAnalytics/MetaAnalytics.jsx index 7cdd01f4..b2590b43 100644 --- a/src/ui/pages/container/Progress/MetaAnalytics/MetaAnalytics.jsx +++ b/src/ui/pages/container/Progress/MetaAnalytics/MetaAnalytics.jsx @@ -104,8 +104,16 @@ export default function MetaAnalytics(props) { }, []); useEffect(() => { - getMetaAnalyticsdata(); - }, []); + const handler = setTimeout(() => { + if(!metaAnalyticsData.length){ + getMetaAnalyticsdata(); + } + }, 500); + return () => { + clearTimeout(handler); + }; + }, []); + const handleSubmit = async () => { getMetaAnalyticsdata(); } @@ -231,8 +239,8 @@ export default function MetaAnalytics(props) { {/* */} - - + + { setProjectTypes(types); }, []); - useEffect(() => { - getTaskAnalyticsdata(); - }, []); + const handler = setTimeout(() => { + if(!taskAnalyticsData.length){ + getTaskAnalyticsdata(); + } + }, 500); + return () => { + clearTimeout(handler); + }; +}, []); + useEffect(() => { if (taskAnalyticsData.length > 0) { @@ -203,8 +210,8 @@ const TaskAnalytics = (props) => { {/* */} - - + +