mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-06 08:50:50 +08:00
fix(core): split view solo view crash (#9432)
This commit is contained in:
@@ -43,8 +43,10 @@ export class Workbench extends Entity {
|
|||||||
activeView$ = LiveData.computed(get => {
|
activeView$ = LiveData.computed(get => {
|
||||||
const activeIndex = get(this.activeViewIndex$);
|
const activeIndex = get(this.activeViewIndex$);
|
||||||
const views = get(this.views$);
|
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 => {
|
location$ = LiveData.computed(get => {
|
||||||
return get(get(this.activeView$).location$);
|
return get(get(this.activeView$).location$);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user