Skip to content

Commit

Permalink
Merge pull request #457 from PermanentOrg/profile-dialog-fixes
Browse files Browse the repository at this point in the history
Profile settings dialog fixes
  • Loading branch information
meisekimiu authored Oct 9, 2024
2 parents 74d9fe1 + 5f57523 commit 083a0c8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/app/core/components/main/main.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
}
}

pr-folder-picker {
z-index: 1010;
}

@include desktop {
:host {
display: flex;
Expand Down
9 changes: 9 additions & 0 deletions src/app/route-history/route-history.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,13 @@ describe('RouteHistoryService', () => {
await router.navigate(['/profile']);
expectRoutesToBeUndefined();
});

it('should not record history on popstate', async () => {
await router.navigate(['/home']);
await router.navigate(['/profile']);
(service as any).popstate = true;
await router.navigate(['/home']);

expect(service.previousRoute).toBeUndefined();
});
});
11 changes: 9 additions & 2 deletions src/app/route-history/route-history.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @format */
import { Injectable, OnDestroy } from '@angular/core';
import { Event, NavigationEnd, Router } from '@angular/router';
import { Event, NavigationEnd, NavigationStart, Router } from '@angular/router';
import { Subscription } from 'rxjs';

@Injectable({
Expand All @@ -11,12 +11,19 @@ export class RouteHistoryService implements OnDestroy {
public previousRoute: string;

private subscription: Subscription;
private popstate: boolean = false;

constructor(router: Router) {
this.subscription = router.events.subscribe((event: Event) => {
if (event instanceof NavigationStart) {
if (event.navigationTrigger === 'popstate') {
this.popstate = true;
}
}
if (event instanceof NavigationEnd) {
this.previousRoute = this.currentRoute;
this.previousRoute = this.popstate ? undefined : this.currentRoute;
this.currentRoute = event.url;
this.popstate = false;
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ export class RoutedDialogWrapperComponent
}

ngOnDestroy(): void {
this.closedByNavigate = true;
if (this.dialogRef) {
this.dialogRef.close();
}
this.closedByNavigate = true;
unsubscribeAll(this.subscriptions);
}

Expand Down

0 comments on commit 083a0c8

Please sign in to comment.