Skip to content

Commit aa6266d

Browse files
committed
fix(app): Fix a regression related to URL fragments triggering navigation when not needed
1 parent 087b251 commit aa6266d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

e2e/cypress/integration/folder-switching.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,13 @@ describe('Switching between folders (and not-folders)', () => {
3333
// and back to inbox...
3434
goToInbox();
3535
});
36+
37+
it('can switch from an open email to another folder', () => {
38+
localStorage.setItem('localSearchPromptDisplayed221', 'true');
39+
40+
cy.visit('/#Inbox:1');
41+
cy.get('rmm-folderlist mat-tree-node:contains(Spam)').click();
42+
cy.url().should('be', '/#Spam');
43+
cy.get('rmm-folderlist mat-tree-node:contains(Spam)').should('have.class', 'selectedFolder');
44+
});
3645
})

src/app/app.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,6 @@ export class AppComponent implements OnInit, AfterViewInit, DoCheck {
887887
return;
888888
}
889889

890-
console.log('Change selectedFolder');
891890
this.clearSelection();
892891

893892
let doResetColumns = false;
@@ -1109,6 +1108,8 @@ export class AppComponent implements OnInit, AfterViewInit, DoCheck {
11091108
if (fragment && this.singlemailviewer?.messageId) {
11101109
fragment += `:${this.singlemailviewer.messageId}`;
11111110
}
1111+
// needed so that our fragment listener doesn't trigger any further navigation
1112+
this.fragment = fragment;
11121113
this.router.navigate(['/'], { fragment });
11131114
}
11141115
}

0 commit comments

Comments
 (0)