diff --git a/frontend/app/components/Client/Projects/ProjectCaptureRate.tsx b/frontend/app/components/Client/Projects/ProjectCaptureRate.tsx index 0f0d76938..f0464ab2a 100644 --- a/frontend/app/components/Client/Projects/ProjectCaptureRate.tsx +++ b/frontend/app/components/Client/Projects/ProjectCaptureRate.tsx @@ -16,7 +16,7 @@ function ProjectCaptureRate(props: Props) { const [conditions, setConditions] = React.useState([]); const { projectId, platform } = props.project; const isMobile = platform !== 'web'; - const { settingsStore, userStore } = useStore(); + const { settingsStore, userStore, customFieldStore } = useStore(); const isAdmin = userStore.account.admin || userStore.account.superAdmin; const isEnterprise = userStore.isEnterprise; const [changed, setChanged] = useState(false); @@ -36,7 +36,13 @@ function ProjectCaptureRate(props: Props) { useEffect(() => { if (projectId) { setChanged(false); - void fetchCaptureConditions(projectId); + const fetchData = async () => { + if (isEnterprise) { + await customFieldStore.fetchListActive(projectId + ''); + } + void fetchCaptureConditions(projectId); + }; + void fetchData(); } }, [projectId]); diff --git a/frontend/app/components/Client/Projects/Projects.tsx b/frontend/app/components/Client/Projects/Projects.tsx index 06e8c64b1..5c78068b4 100644 --- a/frontend/app/components/Client/Projects/Projects.tsx +++ b/frontend/app/components/Client/Projects/Projects.tsx @@ -12,7 +12,7 @@ import ProjectForm from 'Components/Client/Projects/ProjectForm'; import Project from '@/mstore/types/project'; function Projects() { - const { projectsStore } = useStore(); + const { projectsStore, customFieldStore } = useStore(); const history = useHistory(); const { project, pid, tab } = projectsStore.config; const { openModal, closeModal } = useModal(); @@ -23,6 +23,10 @@ function Projects() { const tab = params.get('tab'); projectsStore.setConfigProject(pid ? parseInt(pid) : undefined); projectsStore.setConfigTab(tab); + + return () => { + void customFieldStore.fetchListActive(projectsStore.activeSiteId + ''); + } }, []); React.useEffect(() => {