From 3314480e2041f9bc4f1f08407cb1102eb0843ee3 Mon Sep 17 00:00:00 2001 From: chaw Date: Mon, 16 Nov 2026 09:13:42 +0800 Subject: [PATCH 1/4] fix(CORE-8562): restore experience selector page title --- projects/v3/src/app/app-routing.module.ts | 1 + .../pages/tabs/tabs-routing.module.spec.ts | 23 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/projects/v3/src/app/app-routing.module.ts b/projects/v3/src/app/app-routing.module.ts index 60bf2d14f2..d1b304216c 100644 --- a/projects/v3/src/app/app-routing.module.ts +++ b/projects/v3/src/app/app-routing.module.ts @@ -10,6 +10,7 @@ const routes: Routes = [ }, { path: 'experiences', + title: 'Experiences - Practera', loadChildren: () => import('./pages/experiences/experiences.module').then(m => m.ExperiencesPageModule), canLoad: [AuthGuard], }, diff --git a/projects/v3/src/app/pages/tabs/tabs-routing.module.spec.ts b/projects/v3/src/app/pages/tabs/tabs-routing.module.spec.ts index 4acde8fe5c..3e5b91c554 100644 --- a/projects/v3/src/app/pages/tabs/tabs-routing.module.spec.ts +++ b/projects/v3/src/app/pages/tabs/tabs-routing.module.spec.ts @@ -5,6 +5,7 @@ import { provideRouter, Router } from '@angular/router'; import { RouterTestingHarness } from '@angular/router/testing'; import { BrowserStorageService } from '@v3/services/storage.service'; import { UtilsService } from '@v3/services/utils.service'; +import { AppRoutingModule } from '../../app-routing.module'; import { ChatPage } from '../chat/chat.page'; import { TabsPageRoutingModule } from './tabs-routing.module'; @@ -20,7 +21,7 @@ describe('Tab page titles', () => { beforeEach(async () => { experience = { name: 'Learning & Practice' }; TestBed.configureTestingModule({ - imports: [TabsPageRoutingModule], + imports: [AppRoutingModule, TabsPageRoutingModule], declarations: [ChatPage], schemas: [CUSTOM_ELEMENTS_SCHEMA], providers: [ @@ -37,7 +38,14 @@ describe('Tab page titles', () => { // Keep the production tab routes and title resolvers, replacing page data // loading with an empty page so navigation needs no backend or learner login. const tabs = router.config.find(route => route.children)?.children || []; - router.resetConfig([{ path: 'v3', children: tabs.map(route => ({ + const experiences = router.config.find(route => route.path === 'experiences'); + router.resetConfig([{ + ...experiences, + path: 'experiences', + loadChildren: undefined, + canLoad: undefined, + component: RoutedPage, + }, { path: 'v3', children: tabs.map(route => ({ ...route, children: undefined, loadChildren: route.path === 'messages' @@ -52,6 +60,17 @@ describe('Tab page titles', () => { afterEach(() => title.setTitle(originalTitle)); + it('restores the experience selector title after repeated visits to Events', async () => { + await router.navigateByUrl('/experiences'); + for (let i = 0; i < 3; i++) { + await router.navigateByUrl('/v3/home'); + await router.navigateByUrl('/v3/events'); + expect(title.getTitle()).toBe('Events - Practera'); + await router.navigateByUrl('/experiences'); + expect(title.getTitle()).toBe('Experiences - Practera'); + } + }); + it('restores Events after Home → Events → Messages → Events, repeatedly', async () => { await router.navigateByUrl('/v3/home'); // Simulate the first page creation; cached Ionic pages will not repeat it. From 8eabba9ffb92c341ff3de2a99a4c6cf1a6cf6cf6 Mon Sep 17 00:00:00 2001 From: chaw Date: Mon, 16 Nov 2026 11:42:44 +0800 Subject: [PATCH 2/4] fix(CORE-8562): restore navigation titles and drawer returns --- ...026-11-16-core-8562-navigation-followup.md | 74 +++++++++++ .../notifications/notifications.page.html | 4 +- .../notifications/notifications.page.spec.ts | 125 ++++++++++++++++-- .../pages/notifications/notifications.page.ts | 23 +++- .../review-desktop.page.spec.ts | 115 +++++++++++++++- .../review-desktop/review-desktop.page.ts | 73 +++++++--- .../app/pages/settings/settings.page.spec.ts | 33 +++++ .../src/app/pages/settings/settings.page.ts | 9 +- .../personalised-header.component.spec.ts | 11 ++ .../personalised-header.component.ts | 4 +- 10 files changed, 427 insertions(+), 44 deletions(-) create mode 100644 docs/superpowers/plans/2026-11-16-core-8562-navigation-followup.md diff --git a/docs/superpowers/plans/2026-11-16-core-8562-navigation-followup.md b/docs/superpowers/plans/2026-11-16-core-8562-navigation-followup.md new file mode 100644 index 0000000000..0972aa9b7e --- /dev/null +++ b/docs/superpowers/plans/2026-11-16-core-8562-navigation-followup.md @@ -0,0 +1,74 @@ +# CORE-8562 Navigation Follow-up Implementation Plan + +> **For agentic workers:** Use `superpowers:executing-plans` to implement these tasks in this checkout. Steps use checkboxes for tracking. + +**Goal:** Resolve the four remaining navigation defects reproduced in desktop Safari. + +**Architecture:** Keep route-based static titles and component-owned dynamic review titles. Overlay components preserve the current route title; navigation out of an overlay waits for its dismissal. Successful router navigation restores the active desktop review title. + +**Tech Stack:** Angular 21, Ionic 9 NgModules, RxJS, Karma/Jasmine, Safari. + +**Spec:** Safari findings from CORE-8562: Notifications drawer leaves its title behind; cached desktop Reviews retains Events title; Badges opens behind Settings; direct desktop Notifications Back does nothing. + +## Global Constraints + +- Preserve selected-review names and HTML-entity decoding through UtilsService. +- Use Angular control-flow syntax and the existing Ionic NgModule approach. +- Preserve `prebundle.exclude`; do not add dependencies or store credentials. +- Use NgZone and markForCheck in subscription callbacks; assign overlay spies directly in tests. +- Keep the user's local-development authorization in AGENTS.md intact. + +## Review Focus + +- Notifications opened on Home, Events, or dynamic content must preserve the page title. +- Cached review return must restore a selected name or the empty-list title. +- Hidden or destroyed review subscriptions must not overwrite another page's title. +- Keyboard activation must follow the same dismiss-before-navigate path as clicks. +- Full-page Notifications must support desktop/mobile history and direct-entry fallback. + +## Task 1: Notifications title and Back behavior + +Files: `projects/v3/src/app/pages/notifications/notifications.page.ts`, `.html`, `.spec.ts`; `projects/v3/src/app/personalised-header/personalised-header.component.ts`, `.spec.ts`. + +- [x] Add failing tests for modal title preservation and full-page/modal Back on both screen modes, including direct-entry fallback and ignored keyboard keys. +- [x] Run the Notifications tests and confirm the new cases fail for the observed defects. +- [x] Guard modal title changes. Choose Back behavior by `mode`; record the originating route in mobile header navigation state, return to that route explicitly, and fall back to Home for direct entry. Label the Back/Close controls. +- [x] Rerun the Notifications tests. + +## Task 2: Settings to Badges + +Files: `projects/v3/src/app/pages/settings/settings.page.ts`, `.spec.ts`. + +- [x] Add a failing test proving navigation waits for drawer dismissal, plus full-page and keyboard cases. +- [x] Confirm the failure, then make dismissal awaitable and await it only in modal mode before navigating. +- [x] Rerun Settings tests; include rejected dismissal without navigation. + +## Task 3: Cached desktop review titles + +Files: `projects/v3/src/app/pages/review-desktop/review-desktop.page.ts`, `.spec.ts`. + +- [x] Add failing tests for empty/selected review title restoration, query/matrix/detail routes, hidden background emissions, and destruction. +- [x] Confirm failures. Subscribe to successful router navigation, restore the current review title only on the review route, and clean up subscriptions on destruction. +- [x] Preserve selected review-name titles, including the existing unnamed-review fallback; clear stale selection when no review exists. +- [x] Rerun review and route-title regressions. + +## Task 4: Verification and PR + +- [x] Run the affected suites and full test command. Report baseline fixture errors by file; do not hide them. +- [x] Check development-server compilation and repeat Safari navigation for all four findings, cached returns, original Messages flow, and logout/login if required. +- [x] Review the diff and tests independently before committing and updating PR #2811. +- [x] Investigate CI: the tracked/gitignored-file check passes; Gitleaks reports 75 historical findings. Document this existing blocker without weakening the scan or rewriting history. + +## Execution ruling + +Safari showed that the previous-Angular-navigation/history-length heuristic could leave the app for Start Page after a cached direct-entry return. Record the header's return URL in the Notifications history entry and navigate explicitly to an allowed app destination (or Home), replacing the Notifications entry. This preserves the origin through cached visits and browser Back/Forward without relying on the browser history index. + +## Verification results + +- Red/green: reproduced Notifications/header failures (16 failing new expectations), then passed all 117 tests across Notifications, Settings, Reviews, header, and route-title suites using a temporary scoped TypeScript config. Settings and review regressions also failed before their fixes. +- Full `npm test`: blocked at compilation by existing fixtures: missing `directUrl` in file-display (lines 57, 84), file-upload (96), auth.service (120, 159, 220, 259), and incomplete ProgramObj in experiences (126). These unrelated files were not changed. +- Local Angular server rebuilt and sent page reloads successfully. +- Safari: Notifications drawers preserve Home/Events titles; Reviews returns from Events with its own title; Settings dismisses before Badges appears; routed Badges Back reaches Settings; Due Status and Events titles restore; cached direct-entry Notifications Back returns Home without leaving the app. The selector title appeared while loading, then the account's sole experience was selected automatically. +- Safari limits: account has no Messages link and direct Messages visits did not retain that route; populated review data was unavailable. Unit tests cover Messages/selector route titles, selected review names, and mobile Notifications origin state. Do not treat these as a complete Safari matrix. +- Independent read-only review found no actionable correctness issues, including the explicit-return Back redesign. +- CI remains blocked by 75 historical Gitleaks findings; the tracked-but-ignored-file check itself passed. No scan exceptions were added. diff --git a/projects/v3/src/app/pages/notifications/notifications.page.html b/projects/v3/src/app/pages/notifications/notifications.page.html index 708743a632..863193612d 100644 --- a/projects/v3/src/app/pages/notifications/notifications.page.html +++ b/projects/v3/src/app/pages/notifications/notifications.page.html @@ -3,13 +3,13 @@

Notifications

@if (mode === 'modal') { - + } @if (!mode) { - + } diff --git a/projects/v3/src/app/pages/notifications/notifications.page.spec.ts b/projects/v3/src/app/pages/notifications/notifications.page.spec.ts index 0f7c8d9fab..cb5c5ba346 100644 --- a/projects/v3/src/app/pages/notifications/notifications.page.spec.ts +++ b/projects/v3/src/app/pages/notifications/notifications.page.spec.ts @@ -1,5 +1,5 @@ import { ComponentFixture, fakeAsync, flushMicrotasks, TestBed, waitForAsync } from '@angular/core/testing'; -import { Router } from '@angular/router'; +import { DefaultUrlSerializer, Router } from '@angular/router'; import { UtilsService } from '@v3/services/utils.service'; import { IonicModule, ModalController } from '@ionic/angular/lazy'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; @@ -12,6 +12,7 @@ import { NotificationsPage } from './notifications.page'; import { of } from 'rxjs'; import { MockRouter } from '@testingv3/mocked.service'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { Title } from '@angular/platform-browser'; describe('NotificationsPage', () => { let component: NotificationsPage; @@ -50,13 +51,6 @@ describe('NotificationsPage', () => { provide: Router, useClass: MockRouter }, - { - provide: ModalController, - useValue: jasmine.createSpyObj('ModalController', { - 'dismiss': Promise.resolve(), - 'getTop': Promise.resolve(true), - }), - }, { provide: HomeService, useValue: jasmine.createSpyObj('HomeService', ['getMilestones'], { @@ -76,7 +70,14 @@ describe('NotificationsPage', () => { component = fixture.componentInstance; routerSpy = TestBed.inject(Router); utilsSpy = TestBed.inject(UtilsService); - modalSpy = TestBed.inject(ModalController); + modalSpy = jasmine.createSpyObj('ModalController', { + dismiss: Promise.resolve(true), + getTop: Promise.resolve(true), + }); + (component as any).modalController = modalSpy; + (routerSpy as any).lastSuccessfulNavigation = () => null; + (routerSpy as any).parseUrl = (url: string) => new DefaultUrlSerializer().parse(url); + (routerSpy as any).navigateByUrl = jasmine.createSpy('navigateByUrl').and.returnValue(Promise.resolve(true)); notificationSpy = TestBed.inject(NotificationsService); // reconfigure getTop to return truthy (global test.ts override sets it to null) @@ -90,6 +91,37 @@ describe('NotificationsPage', () => { }); describe('ngOnInit()', () => { + for (const title of ['Local Test Experience', 'Events - Practera', 'Peer feedback']) { + it(`preserves ${title} when Notifications is a drawer`, () => { + const titleService = TestBed.inject(Title); + const originalTitle = titleService.getTitle(); + (utilsSpy.setPageTitle as jasmine.Spy).and.callFake(value => titleService.setTitle(value)); + titleService.setTitle(title); + component.mode = 'modal'; + try { + component.ngOnInit(); + expect(titleService.getTitle()).toBe(title); + component.ngOnDestroy(); + expect(titleService.getTitle()).toBe(title); + } finally { + titleService.setTitle(originalTitle); + } + }); + } + + it('uses the Notifications title for a routed page', () => { + const titleService = TestBed.inject(Title); + const originalTitle = titleService.getTitle(); + (utilsSpy.setPageTitle as jasmine.Spy).and.callFake(value => titleService.setTitle(value)); + try { + titleService.setTitle('Events - Practera'); + component.ngOnInit(); + expect(titleService.getTitle()).toBe('Notifications - Practera'); + } finally { + titleService.setTitle(originalTitle); + } + }); + it('should initiate subscriptions', () => { utilsSpy.isEmpty = jasmine.createSpy('isEmpty').and.returnValue(false); component.ngOnInit(); @@ -244,11 +276,86 @@ describe('NotificationsPage', () => { describe('goBack()', () => { it('should dismiss notification modal', () => { + component.mode = 'modal'; utilsSpy.isMobile = jasmine.createSpy('isMobile').and.returnValue(false); component.goBack(); expect(modalSpy.dismiss).toHaveBeenCalled(); }); + + for (const mobile of [false, true]) { + it(`returns a direct Notifications page to Home (mobile=${mobile})`, async () => { + utilsSpy.isMobile = jasmine.createSpy('isMobile').and.returnValue(mobile); + component.window = { history: { length: 1, back: jasmine.createSpy('back') } }; + await component.goBack(); + expect(routerSpy.navigate).toHaveBeenCalledWith(['v3', 'home'], { replaceUrl: true }); + expect(modalSpy.dismiss).not.toHaveBeenCalled(); + expect(component.window.history.back).not.toHaveBeenCalled(); + }); + + it(`returns to the recorded in-app destination (mobile=${mobile})`, async () => { + utilsSpy.isMobile = jasmine.createSpy('isMobile').and.returnValue(mobile); + (routerSpy as any).lastSuccessfulNavigation = () => ({ previousNavigation: { id: 1 } }); + component.window = { history: { + length: 2, + state: { notificationsReturnUrl: '/v3/activity-mobile/11?view=feedback#answer' }, + back: jasmine.createSpy('back'), + } }; + await component.goBack(); + expect(routerSpy.navigateByUrl).toHaveBeenCalledWith('/v3/activity-mobile/11?view=feedback#answer', { replaceUrl: true }); + expect(component.window.history.back).not.toHaveBeenCalled(); + expect(modalSpy.dismiss).not.toHaveBeenCalled(); + expect(routerSpy.navigate).not.toHaveBeenCalled(); + }); + } + + it('falls back to Home if redirect navigation has no browser history entry', async () => { + (routerSpy as any).lastSuccessfulNavigation = () => ({ previousNavigation: { id: 1 } }); + component.window = { history: { length: 1, back: jasmine.createSpy('back') } }; + await component.goBack(); + expect(routerSpy.navigate).toHaveBeenCalledWith(['v3', 'home'], { replaceUrl: true }); + expect(component.window.history.back).not.toHaveBeenCalled(); + }); + + it('does not return direct entry to unrelated browser history', async () => { + component.window = { history: { length: 3, back: jasmine.createSpy('back') } }; + await component.goBack(); + expect(routerSpy.navigate).toHaveBeenCalledWith(['v3', 'home'], { replaceUrl: true }); + expect(component.window.history.back).not.toHaveBeenCalled(); + }); + + it('returns a cached direct entry to Home even after Angular navigated elsewhere', async () => { + (routerSpy as any).lastSuccessfulNavigation = () => ({ previousNavigation: { id: 2 } }); + component.window = { history: { length: 3, state: { navigationId: 3 }, back: jasmine.createSpy('back') } }; + await component.goBack(); + expect(routerSpy.navigate).toHaveBeenCalledWith(['v3', 'home'], { replaceUrl: true }); + expect(component.window.history.back).not.toHaveBeenCalled(); + }); + + for (const returnUrl of ['/topic-mobile/11/22', '/assessment-mobile/assessment/11/8/11', '/experiences']) { + it(`returns to ${returnUrl}`, async () => { + component.window = { history: { state: { notificationsReturnUrl: returnUrl } } }; + await component.goBack(); + expect(routerSpy.navigateByUrl).toHaveBeenCalledWith(returnUrl, { replaceUrl: true }); + }); + } + + for (const returnUrl of ['https://example.com/', '//example.com/', '/v3/notifications?from=home', '/%invalid', '/auth/logout']) { + it(`falls back to Home for an invalid return destination: ${returnUrl}`, async () => { + component.window = { history: { state: { notificationsReturnUrl: returnUrl } } }; + await component.goBack(); + expect(routerSpy.navigate).toHaveBeenCalledWith(['v3', 'home'], { replaceUrl: true }); + expect(routerSpy.navigateByUrl).not.toHaveBeenCalled(); + }); + } + + it('dismisses a modal even in a mobile layout', async () => { + component.mode = 'modal'; + utilsSpy.isMobile = jasmine.createSpy('isMobile').and.returnValue(true); + await component.goBack(); + expect(modalSpy.dismiss).toHaveBeenCalled(); + expect(routerSpy.navigate).not.toHaveBeenCalled(); + }); }); describe('keyboardEvent', () => { diff --git a/projects/v3/src/app/pages/notifications/notifications.page.ts b/projects/v3/src/app/pages/notifications/notifications.page.ts index eb83e4498d..033ece1cbf 100644 --- a/projects/v3/src/app/pages/notifications/notifications.page.ts +++ b/projects/v3/src/app/pages/notifications/notifications.page.ts @@ -1,6 +1,6 @@ import { ChangeDetectorRef, Component, Inject, Input, NgZone, OnDestroy, OnInit } from '@angular/core'; import { DOCUMENT } from '@angular/common'; -import { Router } from '@angular/router'; +import { PRIMARY_OUTLET, Router } from '@angular/router'; import { NotificationsService, TodoItem } from '@v3/app/services/notifications.service'; import { UtilsService } from '@v3/app/services/utils.service'; import { trigger, transition, useAnimation } from '@angular/animations'; @@ -49,7 +49,9 @@ export class NotificationsPage implements OnInit, OnDestroy { } ngOnInit() { - this.utils.setPageTitle('Notifications - Practera'); + if (this.mode !== 'modal') { + this.utils.setPageTitle('Notifications - Practera'); + } this.subscriptions.push(this.homeService.milestones$.subscribe(async milestones => { if (milestones === null) { this.homeService.getMilestones(); @@ -217,9 +219,22 @@ export class NotificationsPage implements OnInit, OnDestroy { return; } - if (!this.isMobile) { + if (this.mode === 'modal') { return this.dismiss(); } - return this.window.history.back(); + const returnUrl = this.window.history.state?.notificationsReturnUrl; + if (typeof returnUrl === 'string' && returnUrl.startsWith('/') && !returnUrl.startsWith('//')) { + try { + const segments = this.router.parseUrl(returnUrl).root.children[PRIMARY_OUTLET]?.segments || []; + const root = segments[0]?.path; + const allowedRoot = ['v3', 'experiences', 'topic-mobile', 'assessment-mobile'].includes(root); + if (allowedRoot && !(root === 'v3' && segments[1]?.path === 'notifications')) { + return this.router.navigateByUrl(returnUrl, { replaceUrl: true }); + } + } catch { + // Invalid or stale navigation state should still provide a way back to Home. + } + } + return this.router.navigate(['v3', 'home'], { replaceUrl: true }); } } diff --git a/projects/v3/src/app/pages/review-desktop/review-desktop.page.spec.ts b/projects/v3/src/app/pages/review-desktop/review-desktop.page.spec.ts index 13d637ea7d..c1c8058920 100644 --- a/projects/v3/src/app/pages/review-desktop/review-desktop.page.spec.ts +++ b/projects/v3/src/app/pages/review-desktop/review-desktop.page.spec.ts @@ -1,9 +1,9 @@ -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, convertToParamMap, DefaultUrlSerializer, Event as RouterEvent, NavigationEnd, NavigationStart, ParamMap, Router } from '@angular/router'; import { AssessmentService } from '@v3/services/assessment.service'; import { UtilsService } from '@v3/services/utils.service'; import { NotificationsService } from '@v3/services/notifications.service'; import { ReviewService } from '@v3/app/services/review.service'; -import { of, Subject } from 'rxjs'; +import { BehaviorSubject, of, Subject } from 'rxjs'; import { ReviewDesktopPage } from './review-desktop.page'; @@ -13,9 +13,14 @@ describe('ReviewDesktopPage', () => { let reviewService: jasmine.SpyObj; let notificationsService: jasmine.SpyObj; let utilsService: jasmine.SpyObj; + let routerEvents: Subject; + let routerState: { url: string; events: Subject; parseUrl: Router['parseUrl'] }; + let routeSnapshot: { paramMap: ParamMap }; + let reviewsSource: BehaviorSubject; + let originalTitle: string; const createComponent = ({ - submissionId = 1, + submissionId = 0, reviews = [] as any[], assessment = { id: 99, pulseCheck: false } as any, submission = { id: 100, status: 'pending review' } as any, @@ -23,6 +28,14 @@ describe('ReviewDesktopPage', () => { } = {}) => { const paramMap$ = new Subject(); const params$ = new Subject(); + routerEvents = new Subject(); + routerState = { + url: '/v3/review-desktop', + events: routerEvents, + parseUrl: url => new DefaultUrlSerializer().parse(url), + }; + routeSnapshot = { paramMap: convertToParamMap(submissionId ? { submissionId: String(submissionId) } : {}) }; + reviewsSource = new BehaviorSubject(reviews); assessmentService = jasmine.createSpyObj('AssessmentService', [ 'getAssessment', @@ -36,7 +49,7 @@ describe('ReviewDesktopPage', () => { }); reviewService = jasmine.createSpyObj('ReviewService', ['getReviews'], { - reviews$: of(reviews), + reviews$: reviewsSource.asObservable(), }); notificationsService = jasmine.createSpyObj('NotificationsService', [ @@ -47,10 +60,14 @@ describe('ReviewDesktopPage', () => { utilsService = jasmine.createSpyObj('UtilsService', ['setPageTitle', 'isEmpty']); utilsService.isEmpty.and.callFake((value) => value === null || value === undefined || value === ''); + utilsService.setPageTitle.and.callFake(value => { + document.title = UtilsService.prototype.decodeHtmlEntities.call({ document }, value); + }); const activatedRoute = { paramMap: paramMap$.asObservable(), params: params$.asObservable(), + snapshot: routeSnapshot, } as ActivatedRoute; component = new ReviewDesktopPage( @@ -61,6 +78,7 @@ describe('ReviewDesktopPage', () => { notificationsService, { markForCheck: jasmine.createSpy('markForCheck') } as any, { run: jasmine.createSpy('ngZoneRun').and.callFake((fn: () => any) => fn()) } as any, + routerState as unknown as Router, ); component.ngOnInit(); @@ -69,9 +87,98 @@ describe('ReviewDesktopPage', () => { }; beforeEach(() => { + originalTitle = document.title; createComponent(); }); + afterEach(() => { + component.ngOnDestroy(); + reviewsSource.complete(); + document.title = originalTitle; + }); + + const navigate = (url: string, pageTitle?: string) => { + routerState.url = url; + if (pageTitle) document.title = pageTitle; + routerEvents.next(new NavigationEnd(2, url, url)); + }; + + it('restores the empty Reviews title after returning from Events', () => { + navigate('/v3/events', 'Events - Practera'); + navigate('/v3/review-desktop'); + expect(document.title).toBe('Reviews - Practera'); + }); + + for (const url of [ + '/v3/review-desktop', + '/v3/review-desktop?view=details', + '/v3/review-desktop/33;view=details?tab=feedback#answer', + '/v3/review-desktop;view=details', + ]) { + it(`restores the selected review title on return to ${url}`, () => { + if (url.startsWith('/v3/review-desktop/33')) { + routeSnapshot.paramMap = convertToParamMap({ submissionId: '33' }); + component.submissionId = 33; + } + component.goto({ assessmentId: 11, contextId: 22, submissionId: 33, name: 'Peer & feedback' } as any); + navigate('/v3/events', 'Events - Practera'); + navigate(url); + expect(document.title).toBe('Peer & feedback'); + }); + } + + it('preserves another page title when review data arrives in the background', () => { + navigate('/v3/events', 'Events - Practera'); + reviewsSource.next([{ assessmentId: 11, contextId: 22, submissionId: 1, name: 'Background review' }]); + expect(document.title).toBe('Events - Practera'); + navigate('/v3/review-desktop'); + expect(document.title).toBe('Background review'); + }); + + it('clears a stale selected-review title when no review remains', () => { + component.goto({ assessmentId: 11, contextId: 22, submissionId: 33, name: 'Peer feedback' } as any); + component.goto(undefined as any); + navigate('/v3/events', 'Events - Practera'); + navigate('/v3/review-desktop'); + expect(document.title).toBe('Reviews - Practera'); + expect(component.currentReview).toBeUndefined(); + }); + + it('keeps the unnamed-review fallback on cached return', () => { + component.goto({ assessmentId: 11, contextId: 22, submissionId: 33, name: '' } as any); + navigate('/v3/events', 'Events - Practera'); + navigate('/v3/review-desktop'); + expect(document.title).toBe('Review'); + }); + + it('does not retitle a similarly named route', () => { + navigate('/v3/review-desktop-other', 'Other page'); + reviewsSource.next([{ assessmentId: 11, contextId: 22, submissionId: 1, name: 'Background review' }]); + expect(document.title).toBe('Other page'); + }); + + it('does not overwrite the title of a different cached review page', () => { + routeSnapshot.paramMap = convertToParamMap({ submissionId: '33' }); + routerState.url = '/v3/review-desktop/33'; + component.goto({ assessmentId: 11, contextId: 22, submissionId: 33, name: 'First review' } as any); + navigate('/v3/review-desktop/44', 'Second review'); + expect(document.title).toBe('Second review'); + }); + + it('does not restore a title for an unfinished navigation', () => { + document.title = 'Events - Practera'; + routerEvents.next(new NavigationStart(2, '/v3/review-desktop')); + expect(document.title).toBe('Events - Practera'); + }); + + it('stops title updates from router and review streams after destruction', () => { + component.ngOnDestroy(); + document.title = 'New page'; + reviewsSource.next([{ assessmentId: 11, contextId: 22, submissionId: 1, name: 'Late review' }]); + navigate('/v3/review-desktop'); + expect(document.title).toBe('New page'); + }); + it('should create', () => { expect(component).toBeTruthy(); }); diff --git a/projects/v3/src/app/pages/review-desktop/review-desktop.page.ts b/projects/v3/src/app/pages/review-desktop/review-desktop.page.ts index 7a4f36ee80..e7f1a80a75 100644 --- a/projects/v3/src/app/pages/review-desktop/review-desktop.page.ts +++ b/projects/v3/src/app/pages/review-desktop/review-desktop.page.ts @@ -1,10 +1,11 @@ -import { ChangeDetectorRef, Component, NgZone, OnInit } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; +import { ChangeDetectorRef, Component, NgZone, OnDestroy, OnInit } from '@angular/core'; +import { ActivatedRoute, NavigationEnd, PRIMARY_OUTLET, Router } from '@angular/router'; import { Assessment, AssessmentReview, AssessmentService, Submission } from '@v3/app/services/assessment.service'; import { NotificationsService } from '@v3/app/services/notifications.service'; import { Review, ReviewService } from '@v3/app/services/review.service'; import { UtilsService } from '@v3/services/utils.service'; -import { BehaviorSubject, firstValueFrom } from 'rxjs'; +import { BehaviorSubject, firstValueFrom, Subject } from 'rxjs'; +import { filter, takeUntil } from 'rxjs/operators'; @Component({ standalone: false, @@ -12,7 +13,8 @@ import { BehaviorSubject, firstValueFrom } from 'rxjs'; templateUrl: './review-desktop.page.html', styleUrls: ['./review-desktop.page.scss'], }) -export class ReviewDesktopPage implements OnInit { +export class ReviewDesktopPage implements OnInit, OnDestroy { + private readonly destroy$ = new Subject(); loading: boolean; // loading indicator (true = loading | false = done loaded) savingText$: BehaviorSubject = new BehaviorSubject(''); btnDisabled$: BehaviorSubject = new BehaviorSubject(false); @@ -35,38 +37,68 @@ export class ReviewDesktopPage implements OnInit { private notificationsService: NotificationsService, private cdr: ChangeDetectorRef, private ngZone: NgZone, + private router: Router, ) { } ngOnInit(): void { - this.utils.setPageTitle('Reviews - Practera'); - this.assessmentService.assessment$.subscribe(res => { + this.updatePageTitle(); + this.router.events.pipe( + filter(event => event instanceof NavigationEnd), + takeUntil(this.destroy$), + ).subscribe(() => { + this.ngZone.run(() => { + this.updatePageTitle(); + this.cdr.markForCheck(); + }); + }); + this.assessmentService.assessment$.pipe(takeUntil(this.destroy$)).subscribe(res => { this.ngZone.run(() => { this.assessment = res; this.cdr.markForCheck(); }); }); - this.assessmentService.submission$.subscribe(res => { + this.assessmentService.submission$.pipe(takeUntil(this.destroy$)).subscribe(res => { this.ngZone.run(() => { this.submission = res; this.cdr.markForCheck(); }); }); - this.assessmentService.review$.subscribe(res => { + this.assessmentService.review$.pipe(takeUntil(this.destroy$)).subscribe(res => { this.ngZone.run(() => { this.review = res; this.cdr.markForCheck(); }); }); - this.route.paramMap.subscribe(_params => { + this.route.paramMap.pipe(takeUntil(this.destroy$)).subscribe(_params => { this.reviewService.getReviews(); }); - this.route.params.subscribe(params => { - this.submissionId = +params?.submissionId; + this.route.params.pipe(takeUntil(this.destroy$)).subscribe(params => { + this.ngZone.run(() => { + this.submissionId = +params?.submissionId; + this.cdr.markForCheck(); + }); }); - this.reviewService.reviews$.subscribe(reviews => { + this.reviewService.reviews$.pipe(takeUntil(this.destroy$)).subscribe(reviews => { this.ngZone.run(() => { this.reviews = reviews; + if (this.utils.isEmpty(this.submissionId) || this.submissionId === 0) { + this.gotoFirstReview(reviews); + } else { + this.goto(reviews.find(re => re.submissionId === this.submissionId)); + } this.cdr.markForCheck(); }); - if (this.utils.isEmpty(this.submissionId) || this.submissionId === 0) { - this.gotoFirstReview(reviews); - } else if (reviews.length > 0) { // handle directlink - this.goto(reviews.find(re => re.submissionId === this.submissionId)); - } }); } + ngOnDestroy(): void { + this.destroy$.next(); + this.destroy$.complete(); + } + + private updatePageTitle(): void { + // Ionic keeps this page subscribed while another tab is active. + const segments = this.router.parseUrl(this.router.url).root.children[PRIMARY_OUTLET]?.segments || []; + const routeSubmissionId = this.route.snapshot.paramMap.get('submissionId'); + const currentSubmissionId = segments[2]?.path || null; + if (segments.length >= 2 && segments.length <= 3 + && segments[0].path === 'v3' && segments[1].path === 'review-desktop' + && currentSubmissionId === routeSubmissionId) { + this.utils.setPageTitle(this.currentReview ? this.currentReview.name || 'Review' : 'Reviews - Practera'); + } + } + /** * Go to the first review of the review list for desktop */ @@ -87,13 +119,12 @@ export class ReviewDesktopPage implements OnInit { } goto(review: Review) { + this.currentReview = review; + this.noReview = !review; + this.updatePageTitle(); if (!review) { - this.noReview = true; return; } - this.noReview = false; - this.currentReview = review; - this.utils.setPageTitle(review?.name || 'Review'); this.assessmentService.getAssessment(review.assessmentId, 'review', 0, review.contextId, review.submissionId); } diff --git a/projects/v3/src/app/pages/settings/settings.page.spec.ts b/projects/v3/src/app/pages/settings/settings.page.spec.ts index 5cb98ed728..914e934364 100644 --- a/projects/v3/src/app/pages/settings/settings.page.spec.ts +++ b/projects/v3/src/app/pages/settings/settings.page.spec.ts @@ -371,6 +371,39 @@ describe('SettingsPage', () => { }); describe('openBadgeApp()', () => { + for (const event of [ + new Event('click'), + new KeyboardEvent('keydown', { key: 'Enter' }), + new KeyboardEvent('keydown', { key: ' ' }), + ]) { + it(`waits for the Settings drawer to close before navigation (${event.type}, ${(event as KeyboardEvent).key || 'click'})`, async () => { + component.mode = 'modal'; + let finishDismiss: (value: boolean) => void; + modalControllerSpy.dismiss.and.returnValue(new Promise(resolve => { finishDismiss = resolve; })); + routerSpy.navigate.and.returnValue(Promise.resolve(true)); + + const navigation = component.openBadgeApp(event); + expect(routerSpy.navigate).not.toHaveBeenCalled(); + finishDismiss(true); + await navigation; + expect(routerSpy.navigate).toHaveBeenCalledWith(['v3', 'badges-certificates']); + }); + } + + it('does not dismiss an overlay when Settings is a routed page', async () => { + await component.openBadgeApp(new Event('click')); + expect(routerSpy.navigate).toHaveBeenCalledWith(['v3', 'badges-certificates']); + expect(modalControllerSpy.dismiss).not.toHaveBeenCalled(); + }); + + it('does not navigate if drawer dismissal rejects', async () => { + component.mode = 'modal'; + const error = new Error('Dismissal failed'); + modalControllerSpy.dismiss.and.callFake(() => Promise.reject(error)); + await expectAsync(Promise.resolve().then(() => component.openBadgeApp(new Event('click')))).toBeRejectedWith(error); + expect(routerSpy.navigate).not.toHaveBeenCalled(); + }); + it('navigates to badges-certificates on click', () => { component.openBadgeApp(new Event('click')); diff --git a/projects/v3/src/app/pages/settings/settings.page.ts b/projects/v3/src/app/pages/settings/settings.page.ts index b18b1a3dd5..b04f18b77a 100644 --- a/projects/v3/src/app/pages/settings/settings.page.ts +++ b/projects/v3/src/app/pages/settings/settings.page.ts @@ -124,7 +124,7 @@ export class SettingsPage implements OnInit, OnDestroy { } dismiss() { - this.modalController.dismiss({ + return this.modalController.dismiss({ 'dismissed': true }); } @@ -296,10 +296,13 @@ export class SettingsPage implements OnInit, OnDestroy { return this.mailTo(event); } - openBadgeApp(event) { + async openBadgeApp(event): Promise { if (event instanceof KeyboardEvent && event.key !== 'Enter' && event.key !== ' ') { return; } - this.router.navigate(['v3', 'badges-certificates']); + if (this.mode === 'modal') { + await this.dismiss(); + } + return this.router.navigate(['v3', 'badges-certificates']); } } diff --git a/projects/v3/src/app/personalised-header/personalised-header.component.spec.ts b/projects/v3/src/app/personalised-header/personalised-header.component.spec.ts index 3782324748..dc31ea2f16 100644 --- a/projects/v3/src/app/personalised-header/personalised-header.component.spec.ts +++ b/projects/v3/src/app/personalised-header/personalised-header.component.spec.ts @@ -102,6 +102,17 @@ describe('PersonalisedHeaderComponent', () => { expect(component).toBeTruthy(); }); + it('records the current route when opening the mobile Notifications page', async () => { + utils.isMobile.and.returnValue(true); + (router as any).url = '/assessment-mobile/assessment/11/8/11?view=feedback#answer'; + const button: HTMLElement = fixture.nativeElement.querySelector('.notify-btn'); + button.click(); + await fixture.whenStable(); + expect(router.navigate).toHaveBeenCalledWith(['v3', 'notifications'], { + state: { notificationsReturnUrl: '/assessment-mobile/assessment/11/8/11?view=feedback#answer' }, + }); + }); + it('should expose the accessWidget custom trigger before notifications', () => { const accessibilityButton: HTMLElement = fixture.nativeElement.querySelector('.accessibility-btn'); diff --git a/projects/v3/src/app/personalised-header/personalised-header.component.ts b/projects/v3/src/app/personalised-header/personalised-header.component.ts index 255cf38327..ec985f776c 100644 --- a/projects/v3/src/app/personalised-header/personalised-header.component.ts +++ b/projects/v3/src/app/personalised-header/personalised-header.component.ts @@ -75,7 +75,9 @@ export class PersonalisedHeaderComponent implements OnInit, OnDestroy { async notifications(): Promise { if (this.isMobile) { - return this.router.navigate(['v3', 'notifications']); + return this.router.navigate(['v3', 'notifications'], { + state: { notificationsReturnUrl: this.router.url }, + }); } const modal = await this.modalController.create({ From 2a70921f2cb4540b7550e0c54222a93474a2a5a6 Mon Sep 17 00:00:00 2001 From: chaw Date: Mon, 16 Nov 2026 11:48:10 +0800 Subject: [PATCH 3/4] chore(CORE-8562): remove internal workflow document --- ...026-11-16-core-8562-navigation-followup.md | 74 ------------------- 1 file changed, 74 deletions(-) delete mode 100644 docs/superpowers/plans/2026-11-16-core-8562-navigation-followup.md diff --git a/docs/superpowers/plans/2026-11-16-core-8562-navigation-followup.md b/docs/superpowers/plans/2026-11-16-core-8562-navigation-followup.md deleted file mode 100644 index 0972aa9b7e..0000000000 --- a/docs/superpowers/plans/2026-11-16-core-8562-navigation-followup.md +++ /dev/null @@ -1,74 +0,0 @@ -# CORE-8562 Navigation Follow-up Implementation Plan - -> **For agentic workers:** Use `superpowers:executing-plans` to implement these tasks in this checkout. Steps use checkboxes for tracking. - -**Goal:** Resolve the four remaining navigation defects reproduced in desktop Safari. - -**Architecture:** Keep route-based static titles and component-owned dynamic review titles. Overlay components preserve the current route title; navigation out of an overlay waits for its dismissal. Successful router navigation restores the active desktop review title. - -**Tech Stack:** Angular 21, Ionic 9 NgModules, RxJS, Karma/Jasmine, Safari. - -**Spec:** Safari findings from CORE-8562: Notifications drawer leaves its title behind; cached desktop Reviews retains Events title; Badges opens behind Settings; direct desktop Notifications Back does nothing. - -## Global Constraints - -- Preserve selected-review names and HTML-entity decoding through UtilsService. -- Use Angular control-flow syntax and the existing Ionic NgModule approach. -- Preserve `prebundle.exclude`; do not add dependencies or store credentials. -- Use NgZone and markForCheck in subscription callbacks; assign overlay spies directly in tests. -- Keep the user's local-development authorization in AGENTS.md intact. - -## Review Focus - -- Notifications opened on Home, Events, or dynamic content must preserve the page title. -- Cached review return must restore a selected name or the empty-list title. -- Hidden or destroyed review subscriptions must not overwrite another page's title. -- Keyboard activation must follow the same dismiss-before-navigate path as clicks. -- Full-page Notifications must support desktop/mobile history and direct-entry fallback. - -## Task 1: Notifications title and Back behavior - -Files: `projects/v3/src/app/pages/notifications/notifications.page.ts`, `.html`, `.spec.ts`; `projects/v3/src/app/personalised-header/personalised-header.component.ts`, `.spec.ts`. - -- [x] Add failing tests for modal title preservation and full-page/modal Back on both screen modes, including direct-entry fallback and ignored keyboard keys. -- [x] Run the Notifications tests and confirm the new cases fail for the observed defects. -- [x] Guard modal title changes. Choose Back behavior by `mode`; record the originating route in mobile header navigation state, return to that route explicitly, and fall back to Home for direct entry. Label the Back/Close controls. -- [x] Rerun the Notifications tests. - -## Task 2: Settings to Badges - -Files: `projects/v3/src/app/pages/settings/settings.page.ts`, `.spec.ts`. - -- [x] Add a failing test proving navigation waits for drawer dismissal, plus full-page and keyboard cases. -- [x] Confirm the failure, then make dismissal awaitable and await it only in modal mode before navigating. -- [x] Rerun Settings tests; include rejected dismissal without navigation. - -## Task 3: Cached desktop review titles - -Files: `projects/v3/src/app/pages/review-desktop/review-desktop.page.ts`, `.spec.ts`. - -- [x] Add failing tests for empty/selected review title restoration, query/matrix/detail routes, hidden background emissions, and destruction. -- [x] Confirm failures. Subscribe to successful router navigation, restore the current review title only on the review route, and clean up subscriptions on destruction. -- [x] Preserve selected review-name titles, including the existing unnamed-review fallback; clear stale selection when no review exists. -- [x] Rerun review and route-title regressions. - -## Task 4: Verification and PR - -- [x] Run the affected suites and full test command. Report baseline fixture errors by file; do not hide them. -- [x] Check development-server compilation and repeat Safari navigation for all four findings, cached returns, original Messages flow, and logout/login if required. -- [x] Review the diff and tests independently before committing and updating PR #2811. -- [x] Investigate CI: the tracked/gitignored-file check passes; Gitleaks reports 75 historical findings. Document this existing blocker without weakening the scan or rewriting history. - -## Execution ruling - -Safari showed that the previous-Angular-navigation/history-length heuristic could leave the app for Start Page after a cached direct-entry return. Record the header's return URL in the Notifications history entry and navigate explicitly to an allowed app destination (or Home), replacing the Notifications entry. This preserves the origin through cached visits and browser Back/Forward without relying on the browser history index. - -## Verification results - -- Red/green: reproduced Notifications/header failures (16 failing new expectations), then passed all 117 tests across Notifications, Settings, Reviews, header, and route-title suites using a temporary scoped TypeScript config. Settings and review regressions also failed before their fixes. -- Full `npm test`: blocked at compilation by existing fixtures: missing `directUrl` in file-display (lines 57, 84), file-upload (96), auth.service (120, 159, 220, 259), and incomplete ProgramObj in experiences (126). These unrelated files were not changed. -- Local Angular server rebuilt and sent page reloads successfully. -- Safari: Notifications drawers preserve Home/Events titles; Reviews returns from Events with its own title; Settings dismisses before Badges appears; routed Badges Back reaches Settings; Due Status and Events titles restore; cached direct-entry Notifications Back returns Home without leaving the app. The selector title appeared while loading, then the account's sole experience was selected automatically. -- Safari limits: account has no Messages link and direct Messages visits did not retain that route; populated review data was unavailable. Unit tests cover Messages/selector route titles, selected review names, and mobile Notifications origin state. Do not treat these as a complete Safari matrix. -- Independent read-only review found no actionable correctness issues, including the explicit-return Back redesign. -- CI remains blocked by 75 historical Gitleaks findings; the tracked-but-ignored-file check itself passed. No scan exceptions were added. From 6431a53bbb302b41c629921f8c51644234af10cd Mon Sep 17 00:00:00 2001 From: chaw Date: Mon, 16 Nov 2026 12:03:24 +0800 Subject: [PATCH 4/4] fix(CORE-8562): preserve selected review on cached refresh --- .../review-desktop.page.spec.ts | 46 +++++++++++++++++-- .../review-desktop/review-desktop.page.ts | 11 ++++- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/projects/v3/src/app/pages/review-desktop/review-desktop.page.spec.ts b/projects/v3/src/app/pages/review-desktop/review-desktop.page.spec.ts index c1c8058920..c57f426827 100644 --- a/projects/v3/src/app/pages/review-desktop/review-desktop.page.spec.ts +++ b/projects/v3/src/app/pages/review-desktop/review-desktop.page.spec.ts @@ -20,14 +20,14 @@ describe('ReviewDesktopPage', () => { let originalTitle: string; const createComponent = ({ - submissionId = 0, + submissionId = undefined as number | undefined, reviews = [] as any[], assessment = { id: 99, pulseCheck: false } as any, submission = { id: 100, status: 'pending review' } as any, review = { id: 101 } as any, } = {}) => { - const paramMap$ = new Subject(); - const params$ = new Subject(); + const paramMap$ = new BehaviorSubject(convertToParamMap(submissionId ? { submissionId: String(submissionId) } : {})); + const params$ = new BehaviorSubject(submissionId ? { submissionId: String(submissionId) } : {}); routerEvents = new Subject(); routerState = { url: '/v3/review-desktop', @@ -82,8 +82,6 @@ describe('ReviewDesktopPage', () => { ); component.ngOnInit(); - paramMap$.next({}); - params$.next({ submissionId }); }; beforeEach(() => { @@ -135,6 +133,44 @@ describe('ReviewDesktopPage', () => { expect(document.title).toBe('Background review'); }); + it('selects a pending review when the base route has no submissionId parameter', () => { + const pendingReview = { assessmentId: 11, contextId: 22, submissionId: 3, name: 'Review A', isDone: false }; + reviewsSource.next([pendingReview]); + expect(component.currentReview).toEqual(pendingReview as any); + expect(document.title).toBe('Review A'); + }); + + it('keeps the selected review when a cached base route refreshes its reviews', () => { + const first = { assessmentId: 11, contextId: 22, submissionId: 3, name: 'Review A', isDone: false }; + const selected = { assessmentId: 12, contextId: 23, submissionId: 4, name: 'Review B', isDone: false }; + reviewsSource.next([first, selected]); + component.goto(selected as any); + navigate('/v3/home', 'Local Test Experience'); + const refreshed = { ...selected, name: 'Review B refreshed' }; + reviewsSource.next([first, refreshed]); + expect(document.title).toBe('Local Test Experience'); + navigate('/v3/review-desktop'); + expect(component.currentReview).toEqual(refreshed as any); + expect(document.title).toBe('Review B refreshed'); + }); + + it('advances to the next pending review when the selected review becomes completed', () => { + const first = { assessmentId: 11, contextId: 22, submissionId: 3, name: 'Review A', isDone: false }; + const selected = { assessmentId: 12, contextId: 23, submissionId: 4, name: 'Review B', isDone: false }; + reviewsSource.next([first, selected]); + component.goto(selected as any); + reviewsSource.next([first, { ...selected, isDone: true }]); + expect(component.currentReview).toEqual(first as any); + expect(document.title).toBe('Review A'); + }); + + it('clears the selected review when refreshed data no longer contains reviews', () => { + component.goto({ assessmentId: 12, contextId: 23, submissionId: 4, name: 'Review B', isDone: false } as any); + reviewsSource.next([]); + expect(component.currentReview).toBeUndefined(); + expect(document.title).toBe('Reviews - Practera'); + }); + it('clears a stale selected-review title when no review remains', () => { component.goto({ assessmentId: 11, contextId: 22, submissionId: 33, name: 'Peer feedback' } as any); component.goto(undefined as any); diff --git a/projects/v3/src/app/pages/review-desktop/review-desktop.page.ts b/projects/v3/src/app/pages/review-desktop/review-desktop.page.ts index e7f1a80a75..997c346bd4 100644 --- a/projects/v3/src/app/pages/review-desktop/review-desktop.page.ts +++ b/projects/v3/src/app/pages/review-desktop/review-desktop.page.ts @@ -65,7 +65,7 @@ export class ReviewDesktopPage implements OnInit, OnDestroy { }); this.route.params.pipe(takeUntil(this.destroy$)).subscribe(params => { this.ngZone.run(() => { - this.submissionId = +params?.submissionId; + this.submissionId = +params?.submissionId || 0; this.cdr.markForCheck(); }); }); @@ -73,7 +73,14 @@ export class ReviewDesktopPage implements OnInit, OnDestroy { this.ngZone.run(() => { this.reviews = reviews; if (this.utils.isEmpty(this.submissionId) || this.submissionId === 0) { - this.gotoFirstReview(reviews); + // Preserve a cached selection, but advance after completing a review. + const selectedReview = reviews.find(review => review.submissionId === this.currentReview?.submissionId + && review.isDone === this.currentReview.isDone); + if (selectedReview) { + this.goto(selectedReview); + } else { + this.gotoFirstReview(reviews); + } } else { this.goto(reviews.find(re => re.submissionId === this.submissionId)); }