Skip to content

Commit 06025e4

Browse files
committed
embed the item to submission patch request to fix issue where the submission form would revert to the previous data on save
1 parent 404ccd9 commit 06025e4

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/app/core/json-patch/json-patch-operations.service.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ describe('JsonPatchOperationsService test suite', () => {
147147
});
148148

149149
it('should send a new SubmissionPatchRequest', () => {
150-
const expected = new SubmissionPatchRequest(requestService.generateRequestId(), resourceHref, patchOpBody);
150+
const expected = new SubmissionPatchRequest(requestService.generateRequestId(), resourceHref + '?embed=item', patchOpBody);
151151
scheduler.schedule(() => service.jsonPatchByResourceType(resourceEndpoint, resourceScope, testJsonPatchResourceType).subscribe());
152152
scheduler.flush();
153153

@@ -237,7 +237,7 @@ describe('JsonPatchOperationsService test suite', () => {
237237
});
238238

239239
it('should send a new SubmissionPatchRequest', () => {
240-
const expected = new SubmissionPatchRequest(requestService.generateRequestId(), resourceHref, patchOpBody);
240+
const expected = new SubmissionPatchRequest(requestService.generateRequestId(), resourceHref + '?embed=item', patchOpBody);
241241
scheduler.schedule(() => service.jsonPatchByResourceID(resourceEndpoint, resourceScope, testJsonPatchResourceType, testJsonPatchResourceId).subscribe());
242242
scheduler.flush();
243243

src/app/core/json-patch/json-patch-operations.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { getFirstCompletedRemoteData } from '../shared/operators';
1818
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
1919
import { RemoteData } from '../data/remote-data';
2020
import { CoreState } from '../core-state.model';
21+
import { URLCombiner } from '../url-combiner/url-combiner';
2122

2223
/**
2324
* An abstract class that provides methods to make JSON Patch requests.
@@ -125,7 +126,7 @@ export abstract class JsonPatchOperationsService<ResponseDefinitionDomain, Patch
125126
* instance of PatchRequestDefinition
126127
*/
127128
protected getRequestInstance(uuid: string, href: string, body?: any): PatchRequestDefinition {
128-
return new this.patchRequestConstructor(uuid, href, body);
129+
return new this.patchRequestConstructor(uuid, new URLCombiner(href, '?embed=item').toString(), body);
129130
}
130131

131132
protected getEndpointByIDHref(endpoint, resourceID): string {

0 commit comments

Comments
 (0)