Skip to content

Commit 5f1a862

Browse files
committed
fix(nav): returning Promise<false> in canLeave / canEnter works as expected
1 parent 63d495a commit 5f1a862

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/navigation/nav-controller-base.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,13 @@ export class NavControllerBase extends Ion implements NavController {
485485
if (promises.length) {
486486
// darn, async promises, gotta wait for them to resolve
487487
Promise.all(promises)
488-
.then(() => this._postViewInit(enteringView, leavingView, ti, resolve))
489-
.catch(reject);
488+
.then((values: any[]) => {
489+
if (values.some(result => result === false)) {
490+
reject(`ionViewCanEnter rejected`);
491+
} else {
492+
this._postViewInit(enteringView, leavingView, ti, resolve);
493+
}
494+
}).catch(reject);
490495
} else {
491496
// synchronous and all tests passed! let's move on already
492497
this._postViewInit(enteringView, leavingView, ti, resolve);

0 commit comments

Comments
 (0)