Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

common: always remove the last session from history (#7555)

Ammar Ahmedd9c592c7fb0a
diff --git a/packages/common/src/utils/tab-session-history.ts b/packages/common/src/utils/tab-session-history.ts
index 32db99164..ab85c5568 100644
--- a/packages/common/src/utils/tab-session-history.ts
+++ b/packages/common/src/utils/tab-session-history.ts
@@ -117,10 +117,10 @@ export class TabSessionHistory {
remove(tabId: string, sessionId: string) {
const backStack = this.getBackStack(tabId);
- let index = backStack.findIndex((item) => item === sessionId);
+ let index = backStack.lastIndexOf(sessionId);
if (index === -1) {
const forwardStack = this.getForwardStack(tabId);
- index = forwardStack.findIndex((item) => item === sessionId);
+ index = forwardStack.lastIndexOf(sessionId);
forwardStack.splice(index, 1);
this.setForwardStack(tabId, forwardStack);
} else {