diff --git a/app/controllers/authenticated/security/file.ts b/app/controllers/authenticated/security/file.ts index 04f515a45..31a95321f 100644 --- a/app/controllers/authenticated/security/file.ts +++ b/app/controllers/authenticated/security/file.ts @@ -2,7 +2,7 @@ import Controller from '@ember/controller'; import type SecurityFileModel from 'irene/models/security/file'; import type { AkBreadcrumbsItemProps } from 'irene/services/ak-breadcrumbs'; -export default class AuthenticatedSecurityAnalysisController extends Controller { +export default class AuthenticatedSecurityFileController extends Controller { declare model: SecurityFileModel; get breadcrumbs(): AkBreadcrumbsItemProps { diff --git a/app/services/ak-breadcrumbs.ts b/app/services/ak-breadcrumbs.ts index 928e3dc79..0b9ef2b43 100644 --- a/app/services/ak-breadcrumbs.ts +++ b/app/services/ak-breadcrumbs.ts @@ -209,11 +209,11 @@ export default class AkBreadcrumbsService extends Service { // SCENARIO A: In cases where same route exists in crumbs but with diff models, return fallback or recalculate breadcrumbs // SCENARIO B: If navigation to a page is from a different route group return fallback or an empty array to allow for regenration; if ( - (routeFrom && - originCrumbProps?.title && - routeFromCrumbProps?.title && - originCrumbProps?.routeGroup !== routeFromCrumbProps?.routeGroup) || - originRouteHasDiffModelWithSameRouteInCrumbs + routeFrom && + originCrumbProps?.title && + routeFromCrumbProps?.title && + (originCrumbProps?.routeGroup !== routeFromCrumbProps?.routeGroup || + originRouteHasDiffModelWithSameRouteInCrumbs) ) { return ( originCrumbProps?.fallbackCrumbs?.map((it) => ({ @@ -364,7 +364,7 @@ export default class AkBreadcrumbsService extends Service { items: Partial[], route: string ): void { - this.window.localStorage.setItem( + this.window.sessionStorage.setItem( 'lastBreadcrumbsState', JSON.stringify({ route, @@ -384,7 +384,7 @@ export default class AkBreadcrumbsService extends Service { route: string; } | null { return JSON.parse( - this.window.localStorage.getItem('lastBreadcrumbsState') ?? 'null' + this.window.sessionStorage.getItem('lastBreadcrumbsState') ?? 'null' ); } @@ -444,7 +444,8 @@ export default class AkBreadcrumbsService extends Service { (it.route === routeName || this._addIndexToRoute(it.route) === routeName || it.route?.includes(String(routeName))) && - it.models?.join(',') === routeCrumbs?.models?.join(',') + it.models?.join(',') === routeCrumbs?.models?.join(',') && + it.title === routeCrumbs?.title ) ); } diff --git a/tests/acceptance/breadcrumbs-test.js b/tests/acceptance/breadcrumbs-test.js index 81dbc3aa0..a7fc599c8 100644 --- a/tests/acceptance/breadcrumbs-test.js +++ b/tests/acceptance/breadcrumbs-test.js @@ -143,7 +143,7 @@ module('Acceptance | Breadcrumbs Test', function (hooks) { // Clear breadcrumbs in local storage this.window = this.owner.lookup('service:browser/window'); - this.window.localStorage.removeItem('lastBreadcrumbsState'); + this.window.sessionStorage.removeItem('lastBreadcrumbsState'); }); test('forward navigation crumbs generation to registered routes (Root A -> Parent A -> Child A)', async function (assert) {