From b41fa31dd9a0f6308821937159a76400a7d622c8 Mon Sep 17 00:00:00 2001 From: Janet Vorobyeva Date: Tue, 22 Aug 2023 03:17:01 -0400 Subject: [PATCH] Fixes bug 'this.valueFormatter is not a function' (#632) https://grist.slack.com/archives/C069RUP71/p1692034396980779 Bug showed up when deleting a page with the right kinds of widgets/fields, due to a missing isDisposed check Bug was found in DateTextBox, but I added the fix to NTextBox which had an identical bit of code --- app/client/widgets/DateTextBox.js | 2 +- app/client/widgets/NTextBox.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/client/widgets/DateTextBox.js b/app/client/widgets/DateTextBox.js index 87c88de8..388bfae8 100644 --- a/app/client/widgets/DateTextBox.js +++ b/app/client/widgets/DateTextBox.js @@ -83,7 +83,7 @@ DateTextBox.prototype.buildDom = function(row) { let value = row[this.field.colId()]; return dom('div.field_clip', kd.style('text-align', this.alignment), - kd.text(() => row._isAddRow() ? '' : this.valueFormatter().format(value())) + kd.text(() => row._isAddRow() || this.isDisposed() ? '' : this.valueFormatter().format(value())) ); }; diff --git a/app/client/widgets/NTextBox.ts b/app/client/widgets/NTextBox.ts index 1771366e..12f7a780 100644 --- a/app/client/widgets/NTextBox.ts +++ b/app/client/widgets/NTextBox.ts @@ -63,7 +63,9 @@ export class NTextBox extends NewAbstractWidget { return dom('div.field_clip', dom.style('text-align', this.alignment), dom.cls('text_wrapping', this.wrapping), - dom.domComputed((use) => use(row._isAddRow) ? null : makeLinks(use(this.valueFormatter).formatAny(use(value), t))) + dom.domComputed((use) => use(row._isAddRow) || this.isDisposed() ? + null : + makeLinks(use(this.valueFormatter).formatAny(use(value), t))) ); } }