Skip to content

Commit bebcde2

Browse files
authored
fix: router outlet back navigation resilience (#79)
1 parent 6e09583 commit bebcde2

File tree

7 files changed

+12160
-35
lines changed

7 files changed

+12160
-35
lines changed

apps/nativescript-demo-ng/App_Resources/Android/app.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ android {
1010
minSdkVersion 17
1111
targetSdkVersion 29
1212
generatedDensities = []
13-
applicationId = "__PACKAGE__"
13+
applicationId = "org.nativescript.demong"
1414
manifestPlaceholders = [isUnitTesting:"${unitTesting}"]
1515
}
1616
aaptOptions {

apps/nativescript-demo-ng/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"@nativescript-community/ui-material-bottom-navigation": "^7.0.0"
1212
},
1313
"devDependencies": {
14-
"@nativescript/android": "~8.2.0",
15-
"@nativescript/ios": "~8.2.0",
14+
"@nativescript/android": "~8.3.0",
15+
"@nativescript/ios": "~8.3.0",
1616
"@nativescript/unit-test-runner": "^3.0.1"
1717
}
1818
}

apps/nativescript-demo-ng/project.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@
7676
"coverage": false
7777
},
7878
"configurations": {
79-
"android": {},
79+
"android": {
80+
"platform": "android"
81+
},
8082
"ios": {}
8183
}
8284
}

package.json

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,39 +35,39 @@
3535
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
3636
},
3737
"dependencies": {
38-
"@angular/animations": "14.0.4",
39-
"@angular/common": "14.0.4",
40-
"@angular/compiler": "14.0.4",
41-
"@angular/core": "14.0.4",
42-
"@angular/forms": "14.0.4",
43-
"@angular/platform-browser": "14.0.4",
44-
"@angular/platform-browser-dynamic": "14.0.4",
45-
"@angular/router": "14.0.4",
46-
"@nativescript/core": "~8.2.0",
38+
"@angular/animations": "14.1.1",
39+
"@angular/common": "14.1.1",
40+
"@angular/compiler": "14.1.1",
41+
"@angular/core": "14.1.1",
42+
"@angular/forms": "14.1.1",
43+
"@angular/platform-browser": "14.1.1",
44+
"@angular/platform-browser-dynamic": "14.1.1",
45+
"@angular/router": "14.1.1",
46+
"@nativescript/core": "~8.3.0",
4747
"@nativescript/theme": "~3.0.0",
4848
"@ngx-translate/core": "~14.0.0",
4949
"nativescript-ngx-fonticon": "~7.0.0",
5050
"rxjs": "^7.5.0",
5151
"zone.js": "~0.11.5"
5252
},
5353
"devDependencies": {
54-
"@angular-devkit/build-angular": "14.0.4",
55-
"@angular-eslint/eslint-plugin": "14.0.0",
56-
"@angular-eslint/eslint-plugin-template": "14.0.0",
57-
"@angular-eslint/template-parser": "14.0.0",
58-
"@angular/compiler-cli": "14.0.4",
54+
"@angular-devkit/build-angular": "14.1.1",
55+
"@angular-eslint/eslint-plugin": "14.0.2",
56+
"@angular-eslint/eslint-plugin-template": "14.0.2",
57+
"@angular-eslint/template-parser": "14.0.2",
58+
"@angular/compiler-cli": "14.1.1",
5959
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
60-
"@nativescript/types": "~8.2.0",
60+
"@nativescript/types": "~8.3.0",
6161
"@nativescript/unit-test-runner": "^3.0.2",
6262
"@nativescript/webpack": "~5.0.0",
63-
"@ngtools/webpack": "14.0.4",
64-
"@nrwl/angular": "14.4.0",
65-
"@nrwl/cli": "14.4.0",
66-
"@nrwl/eslint-plugin-nx": "14.4.0",
67-
"@nrwl/jest": "14.4.0",
68-
"@nrwl/js": "14.4.0",
69-
"@nrwl/node": "14.4.0",
70-
"@nrwl/workspace": "14.4.0",
63+
"@ngtools/webpack": "14.1.1",
64+
"@nrwl/angular": "14.5.4",
65+
"@nrwl/cli": "14.5.4",
66+
"@nrwl/eslint-plugin-nx": "14.5.4",
67+
"@nrwl/jest": "14.5.4",
68+
"@nrwl/js": "14.5.4",
69+
"@nrwl/node": "14.5.4",
70+
"@nrwl/workspace": "14.5.4",
7171
"@nstudio/angular": "14.3.0",
7272
"@nstudio/nativescript": "14.3.0",
7373
"@nstudio/nativescript-angular": "14.3.0",
@@ -85,15 +85,15 @@
8585
"fs-extra": "^9.0.1",
8686
"husky": "~8.0.1",
8787
"jest": "27.5.1",
88-
"karma": "6.3.20",
88+
"karma": "6.4.0",
8989
"karma-coverage": "2.0.3",
90-
"karma-jasmine": "5.0.1",
90+
"karma-jasmine": "5.1.0",
9191
"karma-mocha-reporter": "^2.2.5",
9292
"karma-nativescript-launcher": "0.4.0",
9393
"karma-sinon": "^1.0.5",
9494
"lint-staged": "^13.0.0",
95-
"ng-packagr": "14.0.2",
96-
"nx": "14.4.0",
95+
"ng-packagr": "14.1.0",
96+
"nx": "14.5.4",
9797
"nyc": "15.1.0",
9898
"postcss": "^8.3.9",
9999
"postcss-import": "14.1.0",

packages/angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/angular",
3-
"version": "14.0.3",
3+
"version": "14.0.4-alpha.0",
44
"homepage": "https://nativescript.org/",
55
"repository": {
66
"type": "git",

packages/angular/src/lib/legacy/router/ns-route-reuse-strategy.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,14 @@ export class NSRouteReuseStrategy implements RouteReuseStrategy {
9999
shouldDetach(route: ActivatedRouteSnapshot): boolean {
100100
route = findTopActivatedRouteNodeForOutlet(route);
101101

102-
const outletKey = this.location.getRouteFullPath(route);
103-
const outlet = this.location.findOutlet(outletKey, route);
102+
const { outlet } = this.findValidOutletAndKey(route);
104103
const key = getSnapshotKey(route);
105-
const isPageActivated = route[pageRouterActivatedSymbol];
104+
105+
let isPageActivated = false;
106+
let tmp = route;
107+
while (!(isPageActivated = tmp[pageRouterActivatedSymbol]) && tmp.parent) {
108+
tmp = tmp.parent;
109+
}
106110
const isBack = outlet ? outlet.isPageNavigationBack : false;
107111
let shouldDetach = outlet && !isBack && isPageActivated;
108112

0 commit comments

Comments
 (0)