refactor: polling is now turned off in development mode

This commit is contained in:
Jordan Knott
2021-04-30 23:36:58 -05:00
parent e2634dc490
commit 167d285d02
8 changed files with 25 additions and 5 deletions

View File

@ -36,6 +36,7 @@ import Input from 'shared/components/Input';
import { useForm } from 'react-hook-form';
import updateApolloCache from 'shared/utils/cache';
import NOOP from 'shared/utils/noop';
import polling from 'shared/utils/polling';
export const ActionsList = styled.ul`
margin: 0;
@ -384,7 +385,7 @@ const Details: React.FC<DetailsProps> = ({
});
const { loading, data, refetch } = useFindTaskQuery({
variables: { taskID },
pollInterval: 3000,
pollInterval: polling.TASK_DETAILS,
fetchPolicy: 'cache-and-network',
});
const [setTaskComplete] = useSetTaskCompleteMutation();

View File

@ -35,6 +35,7 @@ import Board, { BoardLoading } from './Board';
import Details from './Details';
import LabelManagerEditor from './LabelManagerEditor';
import UserManagementPopup from './UserManagementPopup';
import polling from 'shared/utils/polling';
type TaskRouteProps = {
taskID: string;
@ -60,7 +61,7 @@ const Project = () => {
const [updateTaskName] = useUpdateTaskNameMutation();
const { data, error } = useFindProjectQuery({
variables: { projectID },
pollInterval: 3000,
pollInterval: polling.PROJECT,
});
const [toggleTaskLabel] = useToggleTaskLabelMutation({
onCompleted: newTaskLabel => {

View File

@ -22,6 +22,7 @@ import produce from 'immer';
import NOOP from 'shared/utils/noop';
import theme from 'App/ThemeStyles';
import { mixin } from '../shared/utils/styles';
import polling from 'shared/utils/polling';
type CreateTeamData = { teamName: string };
@ -203,7 +204,7 @@ type ShowNewProject = {
const Projects = () => {
const { showPopup, hidePopup } = usePopup();
const { loading, data } = useGetProjectsQuery({ pollInterval: 3000, fetchPolicy: 'cache-and-network' });
const { loading, data } = useGetProjectsQuery({ pollInterval: polling.PROJECTS, fetchPolicy: 'cache-and-network' });
useEffect(() => {
document.title = 'Taskcafé';
}, []);