React Query Integration for Server State Sync in Clinet #245

Merged
admin merged 60 commits from react-query into main 2025-07-11 11:32:19 +00:00
Showing only changes of commit 710af87db1 - Show all commits

View File

@ -32,7 +32,7 @@ const ProjectList = () => {
const HasManageProjectPermission = useHasUserPermission(MANAGE_PROJECT); const HasManageProjectPermission = useHasUserPermission(MANAGE_PROJECT);
const [HasManageProject, setHasManageProject] = useState(HasManageProjectPermission); const [HasManageProject, setHasManageProject] = useState(HasManageProjectPermission);
const { mutate: createProject } = useCreateProject({ const { mutate: createProject,isPending } = useCreateProject({
onSuccessCallback: () => { onSuccessCallback: () => {
setShowModal(false); setShowModal(false);
}, },
@ -78,20 +78,14 @@ const ProjectList = () => {
if (!loading && projects) { if (!loading && projects) {
sortingProject(projects); sortingProject(projects);
} }
}, [projects, loading, selectedStatuses]); // Include selectedStatuses if it changes filtering }, [projects, loading, selectedStatuses]);
useEffect(() => { useEffect(() => {
setHasManageProject(loginUser ? HasManageProjectPermission : false); setHasManageProject(loginUser ? HasManageProjectPermission : false);
}, [loginUser, HasManageProjectPermission]); }, [loginUser, HasManageProjectPermission]);
const handleSubmitForm = (newProject, setLoading, reset) => { const handleSubmitForm = (newProject) => {
setLoading(true); createProject(newProject);
createProject(newProject, {
onSettled: () => {
setLoading(false);
reset();
},
});
}; };
const handleStatusChange = (statusId) => { const handleStatusChange = (statusId) => {
@ -140,6 +134,7 @@ const ProjectList = () => {
project={null} project={null}
handleSubmitForm={handleSubmitForm} handleSubmitForm={handleSubmitForm}
onClose={handleClose} onClose={handleClose}
isPending={isPending}
/> />
</GlobalModel> </GlobalModel>
)} )}