Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove unwanted unsaved change modal #3775

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [1.223.1](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.223.0...v1.223.1) (2025-01-14)

### Bug Fixes

- remove unwanted unsaved change modal ([e46153c](https://github.com/bcgov/CONN-CCBC-portal/commit/e46153c01d42261f9d240fb55ce842b340499cb1))

# [1.223.0](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.222.0...v1.223.0) (2025-01-14)

### Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const ClosePendingRequestModal: React.FC<Props> = ({
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const PendingChangeRequest = ({
orderBy: CREATED_AT_DESC
first: 1
) {
__id
nodes {
comment
isPending
Expand All @@ -49,6 +50,7 @@ const PendingChangeRequest = ({
orderBy: CREATED_AT_DESC
first: 1
) {
__id
nodes {
comment
isPending
Expand All @@ -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
);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const PendingChangeRequestModal: React.FC<Props> = ({
schema={pendingChangeRequestComment}
uiSchema={pendingChangeRequestCommentUiSchema}
formData={formData}
formContext={{ skipUnsavedWarning: true }}
onChange={(e) => setFormData(e.formData)}
disabled={!isHeaderEditable}
// Pass children to hide submit button
Expand Down
1 change: 1 addition & 0 deletions db/sqitch.plan
Original file line number Diff line number Diff line change
Expand Up @@ -780,3 +780,4 @@ mutations/create_assessment_form [mutations/[email protected]] 2024
@1.221.4 2025-01-06T22:46:18Z CCBC Service Account <[email protected]> # release v1.221.4
@1.222.0 2025-01-10T16:34:19Z CCBC Service Account <[email protected]> # release v1.222.0
@1.223.0 2025-01-14T21:14:14Z CCBC Service Account <[email protected]> # release v1.223.0
@1.223.1 2025-01-14T23:37:53Z CCBC Service Account <[email protected]> # release v1.223.1
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CONN-CCBC-portal",
"version": "1.223.0",
"version": "1.223.1",
"main": "index.js",
"repository": "https://github.com/bcgov/CONN-CCBC-portal.git",
"author": "Romer, Meherzad CITZ:EX <[email protected]>",
Expand Down
Loading