diff --git a/app/components/Analyst/PendingChangeRequest/ClosePendingRequestModal.tsx b/app/components/Analyst/PendingChangeRequest/ClosePendingRequestModal.tsx index d5b53549d5..69ceae8f50 100644 --- a/app/components/Analyst/PendingChangeRequest/ClosePendingRequestModal.tsx +++ b/app/components/Analyst/PendingChangeRequest/ClosePendingRequestModal.tsx @@ -56,6 +56,7 @@ const ClosePendingRequestModal: React.FC = ({ schema={pendingChangeRequestCancel} uiSchema={pendingChangeRequestCancelUiSchema} formData={formData} + formContext={{ skipUnsavedWarning: true }} onChange={(e) => setFormData(e.formData)} // Pass children to hide submit button // eslint-disable-next-line react/no-children-prop diff --git a/app/components/Analyst/PendingChangeRequest/PendingChangeRequest.tsx b/app/components/Analyst/PendingChangeRequest/PendingChangeRequest.tsx index d3f33497a8..f9333d4023 100644 --- a/app/components/Analyst/PendingChangeRequest/PendingChangeRequest.tsx +++ b/app/components/Analyst/PendingChangeRequest/PendingChangeRequest.tsx @@ -35,6 +35,7 @@ const PendingChangeRequest = ({ orderBy: CREATED_AT_DESC first: 1 ) { + __id nodes { comment isPending @@ -49,6 +50,7 @@ const PendingChangeRequest = ({ orderBy: CREATED_AT_DESC first: 1 ) { + __id nodes { comment isPending @@ -68,7 +70,7 @@ const PendingChangeRequest = ({ const [isPending, setIsPending] = useState( pendingRequests?.nodes?.[0]?.isPending || false ); - + const connectionId = pendingRequests?.__id; const [comment, setComment] = useState( isPending ? pendingRequests?.nodes?.[0]?.comment : null ); @@ -105,6 +107,18 @@ const PendingChangeRequest = ({ input: input as CreateCbcPendingChangeRequestInput & CreatePendingChangeRequestInput, }, + updater: (store) => { + const payload = store.getRootField( + isCbc ? 'createCbcPendingChangeRequest' : 'createPendingChangeRequest' + ); + const newEdge = payload.getLinkedRecord( + isCbc + ? 'cbcApplicationPendingChangeRequest' + : 'applicationPendingChangeRequest' + ); + const connection = store.get(connectionId); + if (connection) connection.setLinkedRecords([newEdge], 'nodes'); + }, onCompleted: () => { setIsPending(isPendingRequest); setComment(isPendingRequest ? reasonForChange : null); diff --git a/app/components/Analyst/PendingChangeRequest/PendingChangeRequestModal.tsx b/app/components/Analyst/PendingChangeRequest/PendingChangeRequestModal.tsx index a7c8348043..ce26013e71 100644 --- a/app/components/Analyst/PendingChangeRequest/PendingChangeRequestModal.tsx +++ b/app/components/Analyst/PendingChangeRequest/PendingChangeRequestModal.tsx @@ -60,6 +60,7 @@ const PendingChangeRequestModal: React.FC = ({ schema={pendingChangeRequestComment} uiSchema={pendingChangeRequestCommentUiSchema} formData={formData} + formContext={{ skipUnsavedWarning: true }} onChange={(e) => setFormData(e.formData)} disabled={!isHeaderEditable} // Pass children to hide submit button