default project should not be set during the initial fetch. It will be set later based on specific conditions or user actions.

This commit is contained in:
Pramod Mahajan 2025-04-24 10:31:40 +05:30 committed by Gitea Admin
parent f2f7898970
commit d2d1c3cc86

View File

@ -49,19 +49,19 @@ export const useProjects = () =>
fetchData();
}, []);
useEffect( () =>
{
if (projects )
{
if ( profile?.projects && profile?.projects?.length > 0 )
{
dispatch(setProjectId(profile?.projects[0]))
} else
{
dispatch(setProjectId(1))
}
}
}, [profile]);
// useEffect( () =>
// {
// if (projects )
// {
// if ( profile?.projects && profile?.projects?.length > 0 )
// {
// dispatch(setProjectId(profile?.projects[0]))
// } else
// {
// dispatch(setProjectId(1))
// }
// }
// }, [profile]);
return { projects, loading, error, refetch: fetchData };
};