feat: add update polling to relevant views

This commit is contained in:
Jordan Knott 2020-12-23 15:55:17 -06:00
parent c4a80590a1
commit 0c9ab8abc2
7 changed files with 19 additions and 6 deletions

View File

@ -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({

View File

@ -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>;
} }

View File

@ -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: () => {

View File

@ -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({

View File

@ -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é';
}, []); }, []);

View File

@ -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 cant leave because you are the only admin. To make another user an admin, click their avatar, select “Change permissions…”, and select “Admin”.'; 'You cant leave because you are the only admin. To make another user an admin, click their avatar, select “Change permissions…”, and select “Admin”.';

View File

@ -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>;
} }