fix: fix flashing on pollInterval

This commit is contained in:
Jordan Knott
2020-12-23 20:02:38 -06:00
parent 9f27bd157f
commit 8d3b0bd510
8 changed files with 27 additions and 51 deletions

View File

@ -472,9 +472,6 @@ const Members: React.FC<MembersProps> = ({ teamID }) => {
);
},
});
if (loading) {
return <span>loading</span>;
}
if (data && user) {
return (
@ -562,7 +559,7 @@ const Members: React.FC<MembersProps> = ({ teamID }) => {
);
}
return <div>error</div>;
return <div>loading</div>;
};
export default Members;

View File

@ -160,9 +160,6 @@ const TeamProjects: React.FC<TeamProjectsProps> = ({ teamID }) => {
fetchPolicy: 'cache-and-network',
pollInterval: 3000,
});
if (loading) {
return <span>loading</span>;
}
if (data) {
return (
<ProjectsContainer>
@ -193,7 +190,7 @@ const TeamProjects: React.FC<TeamProjectsProps> = ({ teamID }) => {
</ProjectsContainer>
);
}
return <span>error</span>;
return <span>loading</span>;
};
export default TeamProjects;

View File

@ -94,23 +94,6 @@ const Teams = () => {
const { user } = useCurrentUser();
const [currentTab, setCurrentTab] = useState(0);
const match = useRouteMatch();
if (loading) {
return (
<GlobalTopNavbar
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 (!user.isVisible(PermissionLevel.TEAM, PermissionObjectType.TEAM, teamID)) {
return <Redirect to="/" />;
@ -146,7 +129,21 @@ const Teams = () => {
</>
);
}
return <div>Error!</div>;
return (
<GlobalTopNavbar
menuType={[
{ name: 'Projects', link: `${match.url}` },
{ name: 'Members', link: `${match.url}/members` },
]}
currentTab={currentTab}
onSetTab={tab => {
setCurrentTab(tab);
}}
onSaveProjectName={NOOP}
projectID={null}
name={null}
/>
);
};
export default Teams;