fix: flickering when transitioning to some pages

This commit is contained in:
Jordan Knott 2020-09-11 14:41:21 -05:00
parent b603081691
commit aa5e1c0661
3 changed files with 21 additions and 13 deletions

View File

@ -171,7 +171,7 @@ const AddUserPopup: React.FC<AddUserPopupProps> = ({ onAddUser }) => {
const AdminRoute = () => { const AdminRoute = () => {
useEffect(() => { useEffect(() => {
document.title = 'Taskcafé | Admin'; document.title = 'Admin | Taskcafé';
}, []); }, []);
const { loading, data } = useUsersQuery(); const { loading, data } = useUsersQuery();
const { showPopup, hidePopup } = usePopup(); const { showPopup, hidePopup } = usePopup();

View File

@ -260,11 +260,7 @@ const Projects = () => {
}, },
}); });
if (loading) { if (loading) {
return ( return <GlobalTopNavbar onSaveProjectName={NOOP} projectID={null} name={null} />;
<>
<span>loading</span>
</>
);
} }
const colors = ['#e362e3', '#7a6ff0', '#37c5ab', '#aa62e3', '#e8384f']; const colors = ['#e362e3', '#7a6ff0', '#37c5ab', '#aa62e3', '#e8384f'];

View File

@ -85,18 +85,30 @@ type TeamsRouteProps = {
const Teams = () => { const Teams = () => {
const { teamID } = useParams<TeamsRouteProps>(); const { teamID } = useParams<TeamsRouteProps>();
const history = useHistory(); 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 { user } = useCurrentUser();
const [currentTab, setCurrentTab] = useState(0); const [currentTab, setCurrentTab] = useState(0);
const match = useRouteMatch(); const match = useRouteMatch();
useEffect(() => {
document.title = 'Teams | Taskcafé';
}, []);
if (loading) { if (loading) {
return ( return (
<> <GlobalTopNavbar
<span>loading</span> menuType={[
</> { name: 'Projects', link: `${match.url}` },
{ name: 'Members', link: `${match.url}/members` },
]}
currentTab={currentTab}
onSetTab={tab => {
setCurrentTab(tab);
}}
onSaveProjectName={NOOP}
projectID={null}
name={null}
/>
); );
} }
if (data && user) { if (data && user) {