feat: add update polling to relevant views
This commit is contained in:
		@@ -174,7 +174,7 @@ const AdminRoute = () => {
 | 
				
			|||||||
  useEffect(() => {
 | 
					  useEffect(() => {
 | 
				
			||||||
    document.title = 'Admin | Taskcafé';
 | 
					    document.title = 'Admin | Taskcafé';
 | 
				
			||||||
  }, []);
 | 
					  }, []);
 | 
				
			||||||
  const { loading, data } = useUsersQuery();
 | 
					  const { loading, data } = useUsersQuery({ fetchPolicy: 'cache-and-network' });
 | 
				
			||||||
  const { showPopup, hidePopup } = usePopup();
 | 
					  const { showPopup, hidePopup } = usePopup();
 | 
				
			||||||
  const { user } = useCurrentUser();
 | 
					  const { user } = useCurrentUser();
 | 
				
			||||||
  const [deleteInvitedUser] = useDeleteInvitedUserAccountMutation({
 | 
					  const [deleteInvitedUser] = useDeleteInvitedUserAccountMutation({
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -128,7 +128,7 @@ const TeamProjectContainer = styled.div`
 | 
				
			|||||||
const colors = [theme.colors.primary, theme.colors.secondary];
 | 
					const colors = [theme.colors.primary, theme.colors.secondary];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const ProjectFinder = () => {
 | 
					const ProjectFinder = () => {
 | 
				
			||||||
  const { loading, data } = useGetProjectsQuery();
 | 
					  const { loading, data } = useGetProjectsQuery({ fetchPolicy: 'cache-and-network' });
 | 
				
			||||||
  if (loading) {
 | 
					  if (loading) {
 | 
				
			||||||
    return <span>loading</span>;
 | 
					    return <span>loading</span>;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -381,7 +381,11 @@ const Details: React.FC<DetailsProps> = ({
 | 
				
			|||||||
      );
 | 
					      );
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  const { loading, data, refetch } = useFindTaskQuery({ variables: { taskID }, fetchPolicy: 'cache-and-network' });
 | 
					  const { loading, data, refetch } = useFindTaskQuery({
 | 
				
			||||||
 | 
					    variables: { taskID },
 | 
				
			||||||
 | 
					    pollInterval: 3000,
 | 
				
			||||||
 | 
					    fetchPolicy: 'cache-and-network',
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
  const [setTaskComplete] = useSetTaskCompleteMutation();
 | 
					  const [setTaskComplete] = useSetTaskCompleteMutation();
 | 
				
			||||||
  const [updateTaskDueDate] = useUpdateTaskDueDateMutation({
 | 
					  const [updateTaskDueDate] = useUpdateTaskDueDateMutation({
 | 
				
			||||||
    onCompleted: () => {
 | 
					    onCompleted: () => {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -436,6 +436,7 @@ const Project = () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  const { loading, data, error } = useFindProjectQuery({
 | 
					  const { loading, data, error } = useFindProjectQuery({
 | 
				
			||||||
    variables: { projectID },
 | 
					    variables: { projectID },
 | 
				
			||||||
 | 
					    pollInterval: 3000,
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const [updateProjectName] = useUpdateProjectNameMutation({
 | 
					  const [updateProjectName] = useUpdateProjectNameMutation({
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -202,7 +202,7 @@ type ShowNewProject = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const Projects = () => {
 | 
					const Projects = () => {
 | 
				
			||||||
  const { showPopup, hidePopup } = usePopup();
 | 
					  const { showPopup, hidePopup } = usePopup();
 | 
				
			||||||
  const { loading, data } = useGetProjectsQuery({ fetchPolicy: 'network-only' });
 | 
					  const { loading, data } = useGetProjectsQuery({ pollInterval: 3000, fetchPolicy: 'cache-and-network' });
 | 
				
			||||||
  useEffect(() => {
 | 
					  useEffect(() => {
 | 
				
			||||||
    document.title = 'Taskcafé';
 | 
					    document.title = 'Taskcafé';
 | 
				
			||||||
  }, []);
 | 
					  }, []);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -419,7 +419,11 @@ type MembersProps = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const Members: React.FC<MembersProps> = ({ teamID }) => {
 | 
					const Members: React.FC<MembersProps> = ({ teamID }) => {
 | 
				
			||||||
  const { showPopup, hidePopup } = usePopup();
 | 
					  const { showPopup, hidePopup } = usePopup();
 | 
				
			||||||
  const { loading, data } = useGetTeamQuery({ variables: { teamID } });
 | 
					  const { loading, data } = useGetTeamQuery({
 | 
				
			||||||
 | 
					    variables: { teamID },
 | 
				
			||||||
 | 
					    fetchPolicy: 'cache-and-network',
 | 
				
			||||||
 | 
					    pollInterval: 3000,
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
  const { user, setUserRoles } = useCurrentUser();
 | 
					  const { user, setUserRoles } = useCurrentUser();
 | 
				
			||||||
  const warning =
 | 
					  const warning =
 | 
				
			||||||
    'You can’t leave because you are the only admin. To make another user an admin, click their avatar, select “Change permissions…”, and select “Admin”.';
 | 
					    'You can’t leave because you are the only admin. To make another user an admin, click their avatar, select “Change permissions…”, and select “Admin”.';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -155,7 +155,11 @@ type TeamProjectsProps = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const TeamProjects: React.FC<TeamProjectsProps> = ({ teamID }) => {
 | 
					const TeamProjects: React.FC<TeamProjectsProps> = ({ teamID }) => {
 | 
				
			||||||
  const { loading, data } = useGetTeamQuery({ variables: { teamID } });
 | 
					  const { loading, data } = useGetTeamQuery({
 | 
				
			||||||
 | 
					    variables: { teamID },
 | 
				
			||||||
 | 
					    fetchPolicy: 'cache-and-network',
 | 
				
			||||||
 | 
					    pollInterval: 3000,
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
  if (loading) {
 | 
					  if (loading) {
 | 
				
			||||||
    return <span>loading</span>;
 | 
					    return <span>loading</span>;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user