(core) Fixing bug with undoing page delation with a custom layout

Summary:
Fixing a bug: When removing a page with linked sections and then undoing, there are two JS errors raised:
- flexSize is not a function
- getter is not a function

Test Plan: nbrowser tests

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3192
This commit is contained in:
Jarosław Sadziński 2021-12-17 13:16:18 +01:00
parent d1a848b44a
commit d08fdd772e
3 changed files with 8 additions and 1 deletions

View File

@ -439,6 +439,9 @@ Layout.prototype.buildLayout = function(boxSpec, needDynamic) {
Layout.prototype._getBoxSpec = function(layoutBox) { Layout.prototype._getBoxSpec = function(layoutBox) {
var spec = {}; var spec = {};
if (layoutBox.isDisposed()) {
return spec;
}
if (layoutBox.flexSize() && layoutBox.flexSize() !== 100) { if (layoutBox.flexSize() && layoutBox.flexSize() !== 100) {
spec.size = layoutBox.flexSize(); spec.size = layoutBox.flexSize();
} }

View File

@ -138,6 +138,10 @@ export class LinkingState extends Disposable {
): ko.Computed<FilterColValues> { ): ko.Computed<FilterColValues> {
return this.autoDispose(ko.computed(() => { return this.autoDispose(ko.computed(() => {
const srcRowId = this._srcSection.activeRowId(); const srcRowId = this._srcSection.activeRowId();
if (srcRowId === null) {
console.warn("_simpleFilter activeRowId is null");
return { filters: {}, operations: {}};
}
const values = valuesFunc(srcRowId); const values = valuesFunc(srcRowId);
return {filters: {[colId]: values}, operations: {[colId]: operation}} as FilterColValues; return {filters: {[colId]: values}, operations: {[colId]: operation}} as FilterColValues;
})); }));

View File

@ -410,7 +410,7 @@ export function createViewSectionRec(this: ViewSectionRec, docModel: DocModel):
this.linkSrcCol = refRecord(docModel.columns, this.activeLinkSrcColRef); this.linkSrcCol = refRecord(docModel.columns, this.activeLinkSrcColRef);
this.linkTargetCol = refRecord(docModel.columns, this.activeLinkTargetColRef); this.linkTargetCol = refRecord(docModel.columns, this.activeLinkTargetColRef);
this.activeRowId = ko.observable(); this.activeRowId = ko.observable(null);
// If the view instance for this section is instantiated, it will be accessible here. // If the view instance for this section is instantiated, it will be accessible here.
this.viewInstance = ko.observable(null); this.viewInstance = ko.observable(null);