Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): fix active view undefined (#6131)

EYHN9ba47f43bbb9
diff --git a/packages/frontend/core/src/modules/workbench/entities/workbench.ts b/packages/frontend/core/src/modules/workbench/entities/workbench.ts
index 203049aca7..79dc48e392 100644
--- a/packages/frontend/core/src/modules/workbench/entities/workbench.ts
+++ b/packages/frontend/core/src/modules/workbench/entities/workbench.ts
@@ -98,8 +98,9 @@ export class Workbench {
if (index === -1) return;
const newViews = [...this.views.value];
newViews.splice(index, 1);
- if (index !== 0) {
- this.active(index - 1);
+ const activeViewIndex = this.activeViewIndex.value;
+ if (activeViewIndex !== 0 && activeViewIndex >= index) {
+ this.active(activeViewIndex - 1);
}
this.views.next(newViews);
}