Skip to content

Commit

Permalink
fix(edit-page): do not navigate to edit during create
Browse files Browse the repository at this point in the history
since this provokes calling the edit-record.resolver which needs a metadata xml too early and results in an exception
note: bug ccould be reproduced from any second access to /create
  • Loading branch information
tkohr committed Dec 12, 2024
1 parent a94d731 commit 07dcd58
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
16 changes: 0 additions & 16 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,22 +165,6 @@ describe('EditPageComponent', () => {
})
})

describe('new record', () => {
beforeEach(() => {
const activatedRoute = TestBed.inject(ActivatedRoute)
activatedRoute.snapshot.routeConfig.path = '/create'
fixture.detectChanges()
})
it('navigate from /create to /edit/uuid on first change', () => {
const router = TestBed.inject(Router)
const navigateSpy = jest.spyOn(router, 'navigate')
;(facade.draftSaveSuccess$ as any).next()
expect(navigateSpy).toHaveBeenCalledWith(['edit', 'my-dataset-001'], {
replaceUrl: true,
})
})
})

describe('unique identifier of the current record changes', () => {
beforeEach(() => {
fixture.detectChanges()
Expand Down
10 changes: 0 additions & 10 deletions apps/metadata-editor/src/app/edit/edit-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,6 @@ export class EditPageComponent implements OnInit, OnDestroy {
)
})
)

// if we're on the /create route, go to /edit/{uuid} on first change
if (this.route.snapshot.routeConfig?.path.includes('create')) {
this.facade.draftSaveSuccess$.pipe(take(1)).subscribe(() => {
this.router.navigate(['edit', currentRecord.uniqueIdentifier], {
replaceUrl: true,
})
})
}

// if the record unique identifier changes, navigate to /edit/newUuid
this.facade.record$
.pipe(
Expand Down

0 comments on commit 07dcd58

Please sign in to comment.