Skip to content

Commit

Permalink
fix(edit-page): do not navigate to edit with new id when uniqueIdenti…
Browse files Browse the repository at this point in the history
…fier changes

this causes exceptions when modifying fields in a draft.
it does not seem to be used anymore, since the uniqueIdentifier has been replaced by the resourceIdentifier
  • Loading branch information
tkohr committed Dec 12, 2024
1 parent 07dcd58 commit a97b566
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
15 changes: 0 additions & 15 deletions apps/metadata-editor/src/app/edit/edit-page.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,21 +165,6 @@ describe('EditPageComponent', () => {
})
})

describe('unique identifier of the current record changes', () => {
beforeEach(() => {
fixture.detectChanges()
})
it('navigates to /edit/newUuid', () => {
const router = TestBed.inject(Router)
const navigateSpy = jest.spyOn(router, 'navigate')
;(facade.record$ as any).next({
...datasetRecordsFixture()[0],
uniqueIdentifier: 'new-uuid',
})
expect(navigateSpy).toHaveBeenCalledWith(['edit', 'new-uuid'])
})
})

describe('isLastPage$', () => {
let editorFacade: EditorFacadeMock
beforeEach(() => {
Expand Down
12 changes: 0 additions & 12 deletions apps/metadata-editor/src/app/edit/edit-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,6 @@ export class EditPageComponent implements OnInit, OnDestroy {
)
})
)
// if the record unique identifier changes, navigate to /edit/newUuid
this.facade.record$
.pipe(
filter(
(record) =>
record?.uniqueIdentifier !== currentRecord.uniqueIdentifier
),
take(1)
)
.subscribe((savedRecord) => {
this.router.navigate(['edit', savedRecord.uniqueIdentifier])
})
}

ngOnDestroy() {
Expand Down

0 comments on commit a97b566

Please sign in to comment.