Compare commits

..

2 Commits

Author SHA1 Message Date
Patrick Fic
ae05692c46 IO-3531 remove loading on parts order page. 2026-02-02 13:45:25 -08:00
Patrick Fic
e5b7fcb919 IO-3531 Change global apollo config setting to prevent rerenders. 2026-02-02 12:02:11 -08:00
9 changed files with 36 additions and 28 deletions

View File

@@ -57,7 +57,6 @@ const CardPaymentModalComponent = ({
QUERY_RO_AND_OWNER_BY_JOB_PKS, QUERY_RO_AND_OWNER_BY_JOB_PKS,
{ {
fetchPolicy: "network-only", fetchPolicy: "network-only",
notifyOnNetworkStatusChange: true
} }
); );

View File

@@ -47,7 +47,6 @@ export function ChatPopupComponent({ chatVisible, selectedConversation, toggleCh
const [getConversations, { loading, data, refetch, called }] = useLazyQuery(CONVERSATION_LIST_QUERY, { const [getConversations, { loading, data, refetch, called }] = useLazyQuery(CONVERSATION_LIST_QUERY, {
fetchPolicy: "network-only", fetchPolicy: "network-only",
nextFetchPolicy: "network-only", nextFetchPolicy: "network-only",
notifyOnNetworkStatusChange: true,
...(pollInterval > 0 ? { pollInterval } : {}) ...(pollInterval > 0 ? { pollInterval } : {})
}); });

View File

@@ -157,7 +157,6 @@ export function JobsDetailHeaderActions({
variables: watcherVars, variables: watcherVars,
skip: !jobId, skip: !jobId,
fetchPolicy: "cache-first", fetchPolicy: "cache-first",
notifyOnNetworkStatusChange: true
}); });
const jobWatchersCount = jobWatchersData?.job_watchers?.length ?? job?.job_watchers?.length ?? 0; const jobWatchersCount = jobWatchersData?.job_watchers?.length ?? job?.job_watchers?.length ?? 0;

View File

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

View File

@@ -56,7 +56,6 @@ const NotificationCenterContainer = ({ visible, onClose, bodyshop, unreadCount,
where: whereClause where: whereClause
}, },
fetchPolicy: "cache-and-network", fetchPolicy: "cache-and-network",
notifyOnNetworkStatusChange: true,
errorPolicy: "all", errorPolicy: "all",
pollInterval: isConnected ? 0 : day.duration(NOTIFICATION_POLL_INTERVAL_SECONDS, "seconds").asMilliseconds(), pollInterval: isConnected ? 0 : day.duration(NOTIFICATION_POLL_INTERVAL_SECONDS, "seconds").asMilliseconds(),
skip: skipQuery skip: skipQuery

View File

@@ -17,7 +17,6 @@ import AuditTrailMapping from "../../utils/AuditTrailMappings";
import { GenerateDocument } from "../../utils/RenderTemplate"; import { GenerateDocument } from "../../utils/RenderTemplate";
import { TemplateList } from "../../utils/TemplateConstants"; import { TemplateList } from "../../utils/TemplateConstants";
import AlertComponent from "../alert/alert.component"; import AlertComponent from "../alert/alert.component";
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
import PartsOrderModalComponent from "./parts-order-modal.component"; import PartsOrderModalComponent from "./parts-order-modal.component";
import axios from "axios"; import axios from "axios";
import { useTreatmentsWithConfig } from "@splitsoftware/splitio-react"; import { useTreatmentsWithConfig } from "@splitsoftware/splitio-react";
@@ -66,7 +65,7 @@ export function PartsOrderModalContainer({
const sendTypeState = useState("e"); const sendTypeState = useState("e");
const sendType = sendTypeState[0]; const sendType = sendTypeState[0];
const { loading, error, data } = useQuery(QUERY_ALL_VENDORS_FOR_ORDER, { const { error, data } = useQuery(QUERY_ALL_VENDORS_FOR_ORDER, {
skip: !open, skip: !open,
variables: { jobId: jobId }, variables: { jobId: jobId },
fetchPolicy: "network-only", fetchPolicy: "network-only",
@@ -372,6 +371,7 @@ export function PartsOrderModalContainer({
} }
}, [open, linesToOrder, form]); }, [open, linesToOrder, form]);
//This used to have a loading component spinner for the vendor data. With Apollo 4, the NetworkState isn't emitting correctly, so loading just gets set to true the second time, and no longer works as expected.
return ( return (
<Modal <Modal
open={open} open={open}
@@ -390,18 +390,14 @@ export function PartsOrderModalContainer({
> >
{error ? <AlertComponent title={error.message} type="error" /> : null} {error ? <AlertComponent title={error.message} type="error" /> : null}
<Form form={form} layout="vertical" autoComplete="no" onFinish={handleFinish} initialValues={initialValues}> <Form form={form} layout="vertical" autoComplete="no" onFinish={handleFinish} initialValues={initialValues}>
{loading ? ( <PartsOrderModalComponent
<LoadingSpinner /> form={form}
) : ( vendorList={data?.vendors || []}
<PartsOrderModalComponent sendTypeState={sendTypeState}
form={form} isReturn={isReturn}
vendorList={data?.vendors || []} preferredMake={data && data.jobs[0] && data.jobs[0].v_make_desc}
sendTypeState={sendTypeState} job={job}
isReturn={isReturn} />
preferredMake={data && data.jobs[0] && data.jobs[0].v_make_desc}
job={job}
/>
)}
</Form> </Form>
</Modal> </Modal>
); );

View File

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

View File

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

View File

@@ -248,7 +248,8 @@ const client = new ApolloClient({
watchQuery: { watchQuery: {
fetchPolicy: "network-only", fetchPolicy: "network-only",
nextFetchPolicy: "network-only", nextFetchPolicy: "network-only",
errorPolicy: "ignore" errorPolicy: "ignore",
notifyOnNetworkStatusChange: false
}, },
query: { query: {
fetchPolicy: "network-only", fetchPolicy: "network-only",