Skip to content

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

web: fix focus last active tab method (#8034)

01zulfi5b09528e7ea3
diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.ts
index a8cdfcb9d..99198e02b 100644
--- a/apps/web/src/stores/editor-store.ts
+++ b/apps/web/src/stores/editor-store.ts
@@ -851,13 +851,13 @@ class EditorStore extends BaseStore<EditorStore> {
};
focusLastActiveTab = () => {
- const history = useEditorStore.getState().history;
- if (history.length < 2) return;
+ const { tabs, history, focusTab } = this.get();
+ if (tabs.length < 2 || history.length < 2) return;
const previousTab = history.at(-2);
if (!previousTab) return;
- useEditorStore.getState().focusTab(previousTab);
+ focusTab(previousTab);
};
goBack = async () => {