Skip to content

Commit 44f1bcf

Browse files
committed
fix: read navigation extras from the router navigation instead of using stored values
1 parent 3758758 commit 44f1bcf

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/angular/src/lib/legacy/router/page-router-outlet.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Attribute, ChangeDetectorRef, ComponentFactory, ComponentFactoryResolver, ComponentRef, Directive, Inject, InjectionToken, Injector, OnDestroy, EventEmitter, Output, Type, ViewContainerRef, ElementRef, InjectFlags, NgZone, EnvironmentInjector } from '@angular/core';
2-
import { ActivatedRoute, ActivatedRouteSnapshot, ChildrenOutletContexts, Data, PRIMARY_OUTLET, RouterOutletContract } from '@angular/router';
1+
import { Attribute, ChangeDetectorRef, ComponentFactory, ComponentFactoryResolver, ComponentRef, Directive, Inject, InjectionToken, Injector, OnDestroy, EventEmitter, Output, Type, ViewContainerRef, ElementRef, InjectFlags, NgZone, EnvironmentInjector, inject } from '@angular/core';
2+
import { ActivatedRoute, ActivatedRouteSnapshot, ChildrenOutletContexts, Data, PRIMARY_OUTLET, Router, RouterOutletContract } from '@angular/router';
33

44
import { Frame, Page, NavigatedData, profile, NavigationEntry } from '@nativescript/core';
55

@@ -10,11 +10,12 @@ import { NativeScriptDebug } from '../../trace';
1010
import { DetachedLoader } from '../../cdk/detached-loader';
1111
import { ViewUtil } from '../../view-util';
1212
import { NSLocationStrategy } from './ns-location-strategy';
13-
import { Outlet } from './ns-location-utils';
13+
import { defaultNavOptions, Outlet } from './ns-location-utils';
1414
import { NSRouteReuseStrategy } from './ns-route-reuse-strategy';
1515
import { findTopActivatedRouteNodeForOutlet, pageRouterActivatedSymbol, loaderRefSymbol, destroyComponentRef } from './page-router-outlet-utils';
1616
import { registerElement } from '../../element-registry';
1717
import { PageService } from '../../cdk/frame-page/page.service';
18+
import { ExtendedNavigationExtras } from './router-extensions';
1819

1920
export class PageRoute {
2021
activatedRoute: BehaviorSubject<ActivatedRoute>;
@@ -65,6 +66,7 @@ export class PageRouterOutlet implements OnDestroy, RouterOutletContract {
6566
private isEmptyOutlet: boolean;
6667
private viewUtil: ViewUtil;
6768
private frame: Frame;
69+
private router = inject(Router);
6870

6971
attachEvents: EventEmitter<unknown> = new EventEmitter();
7072
detachEvents: EventEmitter<unknown> = new EventEmitter();
@@ -404,7 +406,8 @@ export class PageRouterOutlet implements OnDestroy, RouterOutletContract {
404406
}
405407
});
406408

407-
const navOptions = this.locationStrategy._beginPageNavigation(this.frame);
409+
this.locationStrategy._beginPageNavigation(this.frame);
410+
const navOptions = { ...defaultNavOptions, ...(this.router.getCurrentNavigation().extras || {}) } as ExtendedNavigationExtras;
408411
const isReplace = navOptions.replaceUrl && !navOptions.clearHistory;
409412

410413
// Clear refCache if navigation with clearHistory

0 commit comments

Comments
 (0)