Skip to content

Commit 28c52fd

Browse files
authoredApr 1, 2021
fix(angular): swiping back quickly no longer causes app to get stuck (#23125)
resolves #15154
1 parent b7b97ce commit 28c52fd

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
 

‎angular/src/directives/navigation/ion-router-outlet.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
5252
this._swipeGesture = swipe;
5353

5454
this.nativeEl.swipeHandler = swipe ? {
55-
canStart: () => this.stackCtrl.canGoBack(1),
55+
canStart: () => this.stackCtrl.canGoBack(1) && !this.stackCtrl.hasRunningTask(),
5656
onStart: () => this.stackCtrl.startBackTransition(),
5757
onEnd: shouldContinue => this.stackCtrl.endBackTransition(shouldContinue)
5858
} : undefined;

‎angular/src/directives/navigation/stack-controller.ts

+5
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ export class StackController {
232232
return this.activeView ? this.activeView.stackId : undefined;
233233
}
234234

235+
hasRunningTask(): boolean {
236+
return this.runningTask !== undefined;
237+
}
238+
235239
destroy() {
236240
this.containerEl = undefined!;
237241
this.views.forEach(destroyView);
@@ -294,6 +298,7 @@ export class StackController {
294298
this.runningTask = undefined;
295299
}
296300
const promise = this.runningTask = task();
301+
promise.finally(() => this.runningTask = undefined);
297302
return promise;
298303
}
299304
}

0 commit comments

Comments
 (0)
Please sign in to comment.