IO-1693 Allow 0 line supplements.
This commit is contained in:
@@ -37,7 +37,6 @@ export const GetSupplementDelta = async (client, jobId, newLines) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//Wahtever is left in the existing lines, are lines that should be removed.
|
//Wahtever is left in the existing lines, are lines that should be removed.
|
||||||
|
|
||||||
const insertQueries = linesToInsert.reduce((acc, value, idx) => {
|
const insertQueries = linesToInsert.reduce((acc, value, idx) => {
|
||||||
return acc + generateInsertQuery(value, idx, jobId);
|
return acc + generateInsertQuery(value, idx, jobId);
|
||||||
}, "");
|
}, "");
|
||||||
@@ -49,6 +48,13 @@ export const GetSupplementDelta = async (client, jobId, newLines) => {
|
|||||||
const removeQueries = existingLines.reduce((acc, value, idx) => {
|
const removeQueries = existingLines.reduce((acc, value, idx) => {
|
||||||
return acc + generateRemoveQuery(value, idx);
|
return acc + generateRemoveQuery(value, idx);
|
||||||
}, "");
|
}, "");
|
||||||
|
console.log(insertQueries, updateQueries, removeQueries);
|
||||||
|
|
||||||
|
if ((insertQueries + updateQueries + removeQueries).trim() === "") {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
resolve(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
resolve(gql`
|
resolve(gql`
|
||||||
|
|||||||
@@ -220,12 +220,13 @@ export function JobsAvailableContainer({
|
|||||||
);
|
);
|
||||||
|
|
||||||
delete supp.joblines;
|
delete supp.joblines;
|
||||||
await client.mutate({
|
if (suppDelta !== null) {
|
||||||
mutation: gql`
|
await client.mutate({
|
||||||
${suppDelta}
|
mutation: gql`
|
||||||
`,
|
${suppDelta}
|
||||||
});
|
`,
|
||||||
|
});
|
||||||
|
}
|
||||||
const updateResult = await updateJob({
|
const updateResult = await updateJob({
|
||||||
variables: {
|
variables: {
|
||||||
jobId: selectedJob,
|
jobId: selectedJob,
|
||||||
|
|||||||
Reference in New Issue
Block a user