bugfix/IO-3531 - Disable unnecessary refetch queries causing page reload.

This commit is contained in:
Dave
2026-02-02 12:25:19 -05:00
parent 849d967b56
commit 1566084d9c
3 changed files with 9 additions and 24 deletions

View File

@@ -81,16 +81,17 @@ export function JobsDetailHeader({ job, bodyshop, disabled, insertAuditTrail, is
const employeeData = bodyshop.associations.find((a) => a.useremail === job.admin_clerk)?.user?.employee ?? null;
// Handle checkbox changes
const handleCheckboxChange = async (field, checked) => {
const handleCheckboxChange = async (field, e) => {
e.preventDefault();
e.stopPropagation();
const checked = e.target.checked;
const value = checked ? dayjs().toISOString() : null;
try {
const ret = await updateJob({
variables: {
jobId: job.id,
job: { [field]: value }
},
refetchQueries: ["GET_JOB_BY_PK"],
awaitRefetchQueries: true
}
});
insertAuditTrail({
jobid: job.id,
@@ -182,7 +183,7 @@ export function JobsDetailHeader({ job, bodyshop, disabled, insertAuditTrail, is
<Space>
<Checkbox
checked={!!job.estimate_sent_approval}
onChange={(e) => handleCheckboxChange("estimate_sent_approval", e.target.checked)}
onChange={(e) => handleCheckboxChange("estimate_sent_approval", e)}
disabled={disabled || isPartsEntry}
>
{job.estimate_sent_approval && (
@@ -197,7 +198,7 @@ export function JobsDetailHeader({ job, bodyshop, disabled, insertAuditTrail, is
<Space>
<Checkbox
checked={!!job.estimate_approved}
onChange={(e) => handleCheckboxChange("estimate_approved", e.target.checked)}
onChange={(e) => handleCheckboxChange("estimate_approved", e)}
disabled={disabled || isPartsEntry}
>
{job.estimate_approved && (

View File

@@ -33,8 +33,7 @@ export function TaskListContainer({
currentUser,
onlyMine,
parentJobId,
showRo = true,
disableJobRefetch = false
showRo = true
}) {
const { t } = useTranslation();
const notification = useNotification();
@@ -91,10 +90,6 @@ export function TaskListContainer({
refetchQueries: [Object.keys(query)[0]]
};
if (!disableJobRefetch) {
toggledTaskObject.refetchQueries.push("GET_JOB_BY_PK");
}
const toggledTask = await toggleTaskCompleted(toggledTaskObject);
if (!toggledTask.errors) {
@@ -144,10 +139,6 @@ export function TaskListContainer({
refetchQueries: [Object.keys(query)[0]]
};
if (!disableJobRefetch) {
toggledTaskObject.refetchQueries.push("GET_JOB_BY_PK");
}
const toggledTask = await toggleTaskDeleted(toggledTaskObject);
if (!toggledTask.errors) {

View File

@@ -23,17 +23,10 @@ export function TasksPageComponent({ bodyshop, currentUser, type }) {
relationshipType={"assigned_to"}
query={{ QUERY_MY_TASKS_PAGINATED }}
titleTranslation={"tasks.titles.my_tasks"}
disableJobRefetch={true}
/>
);
case taskPageTypes.ALL_TASKS:
return (
<TaskListContainer
query={{ QUERY_ALL_TASKS_PAGINATED }}
titleTranslation={"tasks.titles.all_tasks"}
disableJobRefetch={true}
/>
);
return <TaskListContainer query={{ QUERY_ALL_TASKS_PAGINATED }} titleTranslation={"tasks.titles.all_tasks"} />;
default:
return <></>;
}