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