fix(ui): metadata reload on project config

This commit is contained in:
Shekar Siri 2025-02-26 14:52:44 +01:00
parent 114bd4080b
commit 256c065153
2 changed files with 13 additions and 3 deletions

View file

@ -16,7 +16,7 @@ function ProjectCaptureRate(props: Props) {
const [conditions, setConditions] = React.useState<Conditions[]>([]);
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]);

View file

@ -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(() => {