mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) When changing a table for a page widget, unset widget-linking to avoid invalid values.
Summary: Previously, using "Change Widget" allowed one to change the underlying table, but would keep the linking settings. This could allow invalid settings which would sometimes lead to JS errors. These manifested in production as "UserError: Query error: n is not a function". - Unset linking settings in this case, to avoid invalid values. - In case invalid values are encountered (e.g. saved previously), treat them as unset, to avoid JS errors. - If an error does occur, report it with a stack trace. Also, for testing, added 'selectBy' option to gristUtils helpers for using page-widget-picker. Test Plan: Added test cases for resetting linking, and for ignoring invalid link settings. Reviewers: alexmojaki Reviewed By: alexmojaki Differential Revision: https://phab.getgrist.com/D2993
This commit is contained in:
@@ -371,6 +371,9 @@ export class PageWidgetSelect extends Disposable {
|
||||
}
|
||||
|
||||
private _selectTable(tid: TableId) {
|
||||
if (tid !== this._value.table.get()) {
|
||||
this._value.link.set(NoLink);
|
||||
}
|
||||
this._value.table.set(tid);
|
||||
this._closeSummarizePanel();
|
||||
}
|
||||
@@ -386,6 +389,7 @@ export class PageWidgetSelect extends Disposable {
|
||||
if (tid !== this._value.table.get()) {
|
||||
this._value.columns.set([]);
|
||||
this._value.table.set(tid);
|
||||
this._value.link.set(NoLink);
|
||||
}
|
||||
this._openSummarizePanel();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user