IO-751 Resolve job close hang with unsaved changes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useApolloClient, useMutation } from "@apollo/client";
|
||||
import { Button, Form, notification, Popconfirm, Space } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useApolloClient, useMutation } from "@apollo/client";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { useHistory } from "react-router-dom";
|
||||
@@ -34,6 +34,8 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
||||
setLoading(true);
|
||||
const result = await client.mutate({
|
||||
mutation: generateJobLinesUpdatesForInvoicing(values.joblines),
|
||||
refetchQueries: ["QUERY_JOB_CLOSE_DETAILS"],
|
||||
awaitRefetchQueries: true,
|
||||
});
|
||||
if (!!!result.errors) {
|
||||
notification["success"]({ message: t("jobs.successes.save") });
|
||||
@@ -45,8 +47,8 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
||||
}),
|
||||
});
|
||||
}
|
||||
// form.resetFields();
|
||||
// form.resetFields();
|
||||
form.resetFields();
|
||||
form.resetFields();
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
@@ -63,7 +65,11 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
||||
});
|
||||
|
||||
if (!!!result.errors) {
|
||||
notification["success"]({ message: t("job.successes.closed") });
|
||||
setLoading(false);
|
||||
|
||||
notification["success"]({
|
||||
message: t("jobs.successes.closed"),
|
||||
});
|
||||
history.push(`/manage/jobs/${job.id}`);
|
||||
} else {
|
||||
setLoading(false);
|
||||
|
||||
Reference in New Issue
Block a user