From aa5e1c0661845bcd558043c025bf1ecdf84a998b Mon Sep 17 00:00:00 2001 From: Jordan Knott Date: Fri, 11 Sep 2020 14:41:21 -0500 Subject: [PATCH] fix: flickering when transitioning to some pages --- frontend/src/Admin/index.tsx | 2 +- frontend/src/Projects/index.tsx | 6 +----- frontend/src/Teams/index.tsx | 26 +++++++++++++++++++------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/frontend/src/Admin/index.tsx b/frontend/src/Admin/index.tsx index 45dfa92..02884c5 100644 --- a/frontend/src/Admin/index.tsx +++ b/frontend/src/Admin/index.tsx @@ -171,7 +171,7 @@ const AddUserPopup: React.FC = ({ onAddUser }) => { const AdminRoute = () => { useEffect(() => { - document.title = 'Taskcafé | Admin'; + document.title = 'Admin | Taskcafé'; }, []); const { loading, data } = useUsersQuery(); const { showPopup, hidePopup } = usePopup(); diff --git a/frontend/src/Projects/index.tsx b/frontend/src/Projects/index.tsx index 1b957e1..3f989b4 100644 --- a/frontend/src/Projects/index.tsx +++ b/frontend/src/Projects/index.tsx @@ -260,11 +260,7 @@ const Projects = () => { }, }); if (loading) { - return ( - <> - loading - - ); + return ; } const colors = ['#e362e3', '#7a6ff0', '#37c5ab', '#aa62e3', '#e8384f']; diff --git a/frontend/src/Teams/index.tsx b/frontend/src/Teams/index.tsx index 012fcc7..4ec2050 100644 --- a/frontend/src/Teams/index.tsx +++ b/frontend/src/Teams/index.tsx @@ -85,18 +85,30 @@ type TeamsRouteProps = { const Teams = () => { const { teamID } = useParams(); const history = useHistory(); - const { loading, data } = useGetTeamQuery({ variables: { teamID } }); + const { loading, data } = useGetTeamQuery({ + variables: { teamID }, + onCompleted: resp => { + document.title = `${resp.findTeam.name} | Taskcafé`; + }, + }); const { user } = useCurrentUser(); const [currentTab, setCurrentTab] = useState(0); const match = useRouteMatch(); - useEffect(() => { - document.title = 'Teams | Taskcafé'; - }, []); if (loading) { return ( - <> - loading - + { + setCurrentTab(tab); + }} + onSaveProjectName={NOOP} + projectID={null} + name={null} + /> ); } if (data && user) {