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

Editor: Fix error when creating new record #1061

Merged
merged 9 commits into from
Dec 19, 2024
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])
})
tkohr marked this conversation as resolved.
Show resolved Hide resolved
}

ngOnDestroy() {
Expand Down
Loading