resolved merge conflict

This commit is contained in:
Pramod Mahajan 2025-05-05 11:34:12 +05:30
parent 4b3f8cc50f
commit 098aa9749f

View File

@ -12,6 +12,11 @@ export const useProjects = () => {
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [error, setError] = useState(""); const [error, setError] = useState("");
const fetchData = async () =>
{
console.log("calldd")
const projectIds = profile?.projects || [];
const projects_cache = getCachedData("projectslist"); const projects_cache = getCachedData("projectslist");
const fetchData = async () => { const fetchData = async () => {
const projectIds = profile?.projects || []; const projectIds = profile?.projects || [];
@ -21,6 +26,7 @@ export const useProjects = () => {
.filter((proj) => projectIds.includes(String(proj.id))) .filter((proj) => projectIds.includes(String(proj.id)))
.sort((a, b) => a.name.localeCompare(b.name)); .sort((a, b) => a.name.localeCompare(b.name));
}; };
const projects_cache = getCachedData("projectList")
if (!projects_cache) { if (!projects_cache) {
setLoading(true); setLoading(true);
@ -44,12 +50,20 @@ export const useProjects = () => {
} }
}; };
useEffect( () =>
{
if ( profile )
{
useEffect(() => { useEffect(() => {
if (profile) { if (profile) {
fetchData(); fetchData();
} }
}, [profile]); }, [profile]);
}, [profile]);
return { projects, loading, error, refetch: fetchData }; return { projects, loading, error, refetch: fetchData };
}; };