Skip to content

Commit

Permalink
fix(core): split view solo view crash
Browse files Browse the repository at this point in the history
  • Loading branch information
pengx17 committed Dec 30, 2024
1 parent 6977b0a commit bcbad8e
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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$);
});
Expand Down Expand Up @@ -127,9 +129,9 @@ export class Workbench extends Entity {
id:
| string
| ({ docId: string } & (
| ReferenceParams
| Record<string, string | undefined>
)),
| ReferenceParams
| Record<string, string | undefined>
)),
options?: WorkbenchOpenOptions
) {
const isString = typeof id === 'string';
Expand Down

0 comments on commit bcbad8e

Please sign in to comment.