(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
This commit is contained in:
Jarosław Sadziński 2022-03-24 19:33:53 +01:00
parent 546096fcc9
commit 64c9717ac1
2 changed files with 5 additions and 2 deletions

View File

@ -924,12 +924,12 @@ export class GristDoc extends DisposableWithEvents {
*/ */
private async _switchToSectionId(sectionId: number) { private async _switchToSectionId(sectionId: number) {
const section: ViewSectionRec = this.docModel.viewSections.getRowModel(sectionId); const section: ViewSectionRec = this.docModel.viewSections.getRowModel(sectionId);
const view: ViewRec = section.view.peek(); if (section.isRaw.peek()) {
if (!view.id.peek()) {
// This is raw data view // This is raw data view
await urlState().pushUrl({docPage: 'data'}); await urlState().pushUrl({docPage: 'data'});
this.viewModel.activeSectionId(sectionId); this.viewModel.activeSectionId(sectionId);
} else { } else {
const view: ViewRec = section.view.peek();
await this.openDocPage(view.getRowId()); await this.openDocPage(view.getRowId());
view.activeSectionId(sectionId); // this.viewModel will reflect this with a delay. view.activeSectionId(sectionId); // this.viewModel will reflect this with a delay.
} }

View File

@ -163,6 +163,9 @@ function createNodes(docModel: DocModel, sections: MaybeSection[]) {
// Creates an array of LinkNode from a view section record. // Creates an array of LinkNode from a view section record.
function fromViewSectionRec(section: ViewSectionRec): LinkNode[] { function fromViewSectionRec(section: ViewSectionRec): LinkNode[] {
if (section.isDisposed()) {
return [];
}
const table = section.table.peek(); const table = section.table.peek();
const ancestors = new Set<number>(); const ancestors = new Set<number>();