diff --git a/client/src/components/task-upsert-modal/task-upsert-modal.component.jsx b/client/src/components/task-upsert-modal/task-upsert-modal.component.jsx index a1b7906a6..10e34122a 100644 --- a/client/src/components/task-upsert-modal/task-upsert-modal.component.jsx +++ b/client/src/components/task-upsert-modal/task-upsert-modal.component.jsx @@ -175,7 +175,11 @@ export function TaskUpsertModalComponent({ employee.user_email === currentUser.email && employee.active) + ? currentUser.email + : undefined + } rules={[ { required: true diff --git a/client/src/components/task-upsert-modal/task-upsert-modal.container.jsx b/client/src/components/task-upsert-modal/task-upsert-modal.container.jsx index c8883404e..d4dc369e9 100644 --- a/client/src/components/task-upsert-modal/task-upsert-modal.container.jsx +++ b/client/src/components/task-upsert-modal/task-upsert-modal.container.jsx @@ -5,7 +5,7 @@ import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { MUTATION_INSERT_NEW_TASK, MUTATION_UPDATE_TASK, QUERY_GET_TASK_BY_ID } from "../../graphql/tasks.queries"; -import { QUERY_GET_TASKS_JOB_DETAILS_BY_ID } from "../../graphql/jobs.queries.js"; +import { GET_JOB_BY_PK, QUERY_GET_TASKS_JOB_DETAILS_BY_ID } from "../../graphql/jobs.queries.js"; import { toggleModalVisible } from "../../redux/modals/modals.actions"; import { selectTaskUpsert } from "../../redux/modals/modals.selectors"; import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors"; @@ -122,10 +122,13 @@ export function TaskUpsertModalContainer({ bodyshop, currentUser, taskUpsert, to refetchQueries: [] }; - // We have relationship IDS, so we need to refetch the job - if (jobid || joblineid || billid || partsorderid) { - taskObject.refetchQueries.push("GET_JOB_BY_PK"); - } + // We need to make sure this is updated everywhere + taskObject.refetchQueries.push({ + query: GET_JOB_BY_PK, + variables: { + id: existingTask.jobid + } + }); // We have a relationship query, so we need to refetch the query if (query && Object.keys(query).length) { @@ -189,10 +192,13 @@ export function TaskUpsertModalContainer({ bodyshop, currentUser, taskUpsert, to refetchQueries: [] }; - // We have relationship IDS, so we need to refetch the job - if (jobid || joblineid || billid || partsorderid) { - newTaskObject.refetchQueries.push("GET_JOB_BY_PK"); - } + // We need to make sure this is updated everywhere + newTaskObject.refetchQueries.push({ + query: GET_JOB_BY_PK, + variables: { + id: values.jobid + } + }); // We have a relationship query, so we need to refetch the query if (query && Object.keys(query).length) {