- additional cleanup and validation / fixes

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-04-11 14:44:21 -04:00
parent 77c486b4c9
commit 8cce6ea6e3
4 changed files with 46 additions and 13 deletions

View File

@@ -16,7 +16,7 @@ const mapStateToProps = createStructuredSelector({
currentUser: selectCurrentUser
});
const mapDispatchToProps = (dispatch) => ({});
const mapDispatchToProps = () => ({});
export default connect(mapStateToProps, mapDispatchToProps)(TaskUpsertModalComponent);

View File

@@ -119,9 +119,15 @@ export function TaskUpsertModalContainer({ bodyshop, currentUser, taskUpsert, to
taskId: existingTask.id,
task: replaceUndefinedWithNull(values)
},
refetchQueries: ["GET_JOB_BY_PK"]
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 have a relationship query, so we need to refetch the query
if (query && Object.keys(query).length) {
taskObject.refetchQueries.push(Object.keys(query)[0]);
}
@@ -180,9 +186,15 @@ export function TaskUpsertModalContainer({ bodyshop, currentUser, taskUpsert, to
}
]
},
refetchQueries: ["GET_JOB_BY_PK"]
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 have a relationship query, so we need to refetch the query
if (query && Object.keys(query).length) {
newTaskObject.refetchQueries.push(Object.keys(query)[0]);
}