Unified History: Going to a dashboard page creates two history entries (#98333)

This commit is contained in:
Laura Fernández 2025-01-10 14:59:06 +01:00 committed by GitHub
parent 6c1cce407a
commit 7660fa3921
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -145,13 +145,17 @@ export class AppChromeService {
return entries;
}
let lastEntry = entries[0];
if (!lastEntry || lastEntry.name !== newPageNav.text) {
lastEntry = { name: newPageNav.text, views: [], breadcrumbs, time: Date.now(), url: window.location.href };
}
if (lastEntry !== entries[0]) {
entries = [lastEntry, ...entries];
const lastEntry = entries[0];
const newEntry = { name: newPageNav.text, views: [], breadcrumbs, time: Date.now(), url: window.location.href };
const isSameUrl = lastEntry && newEntry.url === lastEntry.url;
// To avoid adding an entry with the same url twice, we always use the latest one
if (isSameUrl) {
entries[0] = newEntry;
} else {
entries = [newEntry, ...entries];
}
return entries;
}
private ignoreStateUpdate(newState: AppChromeState, current: AppChromeState) {