diff --git a/public/app/core/components/AppChrome/AppChromeService.tsx b/public/app/core/components/AppChrome/AppChromeService.tsx index 55ec8cf7490..85f2a5cdd83 100644 --- a/public/app/core/components/AppChrome/AppChromeService.tsx +++ b/public/app/core/components/AppChrome/AppChromeService.tsx @@ -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) {