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): split view solo view crash (#9432)

pengx1779e006467c20
diff --git a/packages/frontend/core/src/modules/workbench/entities/workbench.ts b/packages/frontend/core/src/modules/workbench/entities/workbench.ts
index 09bbb38901..c6c761b0ac 100644
--- a/packages/frontend/core/src/modules/workbench/entities/workbench.ts
+++ b/packages/frontend/core/src/modules/workbench/entities/workbench.ts
@@ -43,8 +43,10 @@ export class Workbench extends Entity {
activeView$ = LiveData.computed(get => {
const activeIndex = get(this.activeViewIndex$);
const views = get(this.views$);
- return views[activeIndex]; // todo: this could be null
+ // activeIndex could be out of bounds when reordering views
+ return views.at(activeIndex) || views[0];
});
+
location$ = LiveData.computed(get => {
return get(get(this.activeView$).location$);
});