From 5e96ccdd995a37863eb5b5da289666d782c1b317 Mon Sep 17 00:00:00 2001 From: swtmply Date: Wed, 24 May 2023 03:17:41 +0800 Subject: [PATCH] IO-2297 added optimistic response and click outside function --- .../production-list-columns.date.component.jsx | 10 +++++++++- client/src/graphql/jobs.queries.js | 3 +++ yarn.lock | 11 +++-------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/client/src/components/production-list-columns/production-list-columns.date.component.jsx b/client/src/components/production-list-columns/production-list-columns.date.component.jsx index 4944d628b..06a5c04d3 100644 --- a/client/src/components/production-list-columns/production-list-columns.date.component.jsx +++ b/client/src/components/production-list-columns/production-list-columns.date.component.jsx @@ -25,6 +25,7 @@ export default function ProductionListDate({ // } //e.stopPropagation(); + updateAlert({ variables: { jobId: record.id, @@ -32,6 +33,11 @@ export default function ProductionListDate({ [field]: date, }, }, + optimisticResponse: { + update_jobs: { + [field]: date, + }, + }, }).then(() => { if (record.refetch) record.refetch(); if (!time) { @@ -49,9 +55,11 @@ export default function ProductionListDate({ (moment().add(1, "day").isSame(moment(record[field]), "day") && "production-completion-soon")); } + return ( setVisible(v)} visible={visible} style={{ height: "19px", diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 103e21b16..9619d5173 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -1075,6 +1075,9 @@ export const UPDATE_JOB = gql` lbr_adjustments suspended queued_for_parts + scheduled_completion + actual_in + date_repairstarted } } } diff --git a/yarn.lock b/yarn.lock index 9659256b2..d859830cb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4312,14 +4312,9 @@ tslib@^1.11.1: integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== tslib@^2.0.1, tslib@^2.1.0: - -tslib@^2.3.1, tslib@^2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" - integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== - version "2.5.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" - integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== + version "2.5.2" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.2.tgz#1b6f07185c881557b0ffa84b111a0106989e8338" + integrity sha512-5svOrSA2w3iGFDs1HibEVBGbDrAY82bFQ3HZ3ixB+88nsbsWQoKqDRb5UBYAUPEzbBn6dAp5gRNXglySbx1MlA== tslib@^2.3.1, tslib@^2.5.0: version "2.5.0"