[SM-571] reenable route reuse on destroy (#4883)

This commit is contained in:
Will Martin 2023-02-27 14:46:05 -05:00 committed by GitHub
parent 3e03c95a10
commit ff89d86d40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -54,6 +54,7 @@ type Tasks = {
})
export class OverviewComponent implements OnInit, OnDestroy {
private destroy$: Subject<void> = new Subject<void>();
private prevShouldReuseRoute: any;
private tableSize = 10;
private organizationId: string;
protected organizationName: string;
@ -80,6 +81,7 @@ export class OverviewComponent implements OnInit, OnDestroy {
* We want to remount the `sm-onboarding` component on route change.
* The component only toggles its visibility on init and on user dismissal.
*/
this.prevShouldReuseRoute = this.router.routeReuseStrategy.shouldReuseRoute;
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
}
@ -133,6 +135,7 @@ export class OverviewComponent implements OnInit, OnDestroy {
}
ngOnDestroy(): void {
this.router.routeReuseStrategy.shouldReuseRoute = this.prevShouldReuseRoute;
this.destroy$.next();
this.destroy$.complete();
}