From 64c9717ac16401170c560128a8d9effa8e4f0eca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Sadzi=C5=84ski?= Date: Thu, 24 Mar 2022 19:33:53 +0100 Subject: [PATCH] (core) Undo bug with summary table and raw data view Summary: Clicking undo/redo after converting a table to a summary table navigated to the raw data view. Test Plan: new test Reviewers: georgegevoian, alexmojaki Reviewed By: georgegevoian, alexmojaki Subscribers: alexmojaki Differential Revision: https://phab.getgrist.com/D3337 --- app/client/components/GristDoc.ts | 4 ++-- app/client/ui/selectBy.ts | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) 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();