fix(core): split view solo view crash (#9432)

This commit is contained in:
pengx17
2024-12-30 16:54:44 +00:00
parent 397a48380e
commit 79e006467c
@@ -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$);
}); });