diff --git a/app/client/components/GristDoc.ts b/app/client/components/GristDoc.ts index 5c38ac18..6dc643ce 100644 --- a/app/client/components/GristDoc.ts +++ b/app/client/components/GristDoc.ts @@ -924,12 +924,12 @@ export class GristDoc extends DisposableWithEvents { */ private async _switchToSectionId(sectionId: number) { const section: ViewSectionRec = this.docModel.viewSections.getRowModel(sectionId); - const view: ViewRec = section.view.peek(); - if (!view.id.peek()) { + if (section.isRaw.peek()) { // This is raw data view await urlState().pushUrl({docPage: 'data'}); this.viewModel.activeSectionId(sectionId); } else { + const view: ViewRec = section.view.peek(); await this.openDocPage(view.getRowId()); view.activeSectionId(sectionId); // this.viewModel will reflect this with a delay. } diff --git a/app/client/ui/selectBy.ts b/app/client/ui/selectBy.ts index 44a5f05e..ce4675d7 100644 --- a/app/client/ui/selectBy.ts +++ b/app/client/ui/selectBy.ts @@ -163,6 +163,9 @@ function createNodes(docModel: DocModel, sections: MaybeSection[]) { // Creates an array of LinkNode from a view section record. function fromViewSectionRec(section: ViewSectionRec): LinkNode[] { + if (section.isDisposed()) { + return []; + } const table = section.table.peek(); const ancestors = new Set();