diff --git a/client/src/components/Lists/TicketList.tsx b/client/src/components/Lists/TicketList.tsx index 50e554a..3a929a7 100644 --- a/client/src/components/Lists/TicketList.tsx +++ b/client/src/components/Lists/TicketList.tsx @@ -52,6 +52,7 @@ const TicketList: FC = ({ }; const [showNew, setShowNew] = useState(false); + let filteredTickets = tickets.filter( (t) => t.status !== "Done" && diff --git a/client/src/controllers/ProjectController.tsx b/client/src/controllers/ProjectController.tsx index a84599e..f3d9c68 100644 --- a/client/src/controllers/ProjectController.tsx +++ b/client/src/controllers/ProjectController.tsx @@ -27,7 +27,6 @@ const ProjectController: FC = () => { const project: Project = await Projects.get(id); if (project !== undefined) { setProject(project); - setIsLoading(false); } } catch (ex) { setHasError(true); @@ -42,7 +41,6 @@ const ProjectController: FC = () => { const response: User[] = await Users.all(); if (response !== undefined) { setAllUsers(response); - setIsLoading(false); } } catch (ex) { setHasError(true); @@ -63,16 +61,19 @@ const ProjectController: FC = () => { setError(ex); } }; - if (id !== undefined) { - getProject(id); - getAllUsers(); - getAllProjects(); + // wait for all data to be fetched + Promise.all([getProject(id), getAllUsers(), getAllProjects()]) + .then(() => setIsLoading(false)) + .catch((ex) => { + setHasError(true); + setError(ex); + }); } else { setHasError(true); setError("Bad Request"); } - }, [id, getTokenSilently]); + }, [id]); if (hasError) { return ;