(core) Fix the switch of a new column from Common to Separate settings

Summary:
The switching between Common and Separate settings for a field was broken when
the field had never modified settings.

Test Plan: Added a test case that tickles the issue and tests the fix.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4072
This commit is contained in:
Dmitry S
2023-10-11 01:43:14 -04:00
parent 1be1e5f647
commit 519f2f4fb6
2 changed files with 72 additions and 1 deletions

View File

@@ -502,7 +502,7 @@ export class FieldBuilder extends Disposable {
return this.gristDoc.docData.bundleActions(
t("Use separate field settings for {{colId}}", { colId: this.origColumn.colId() }), () => {
return Promise.all([
setSaveValue(this.field.widgetOptions, this.field.column().widgetOptions()),
setSaveValue(this.field.widgetOptions, this.field.column().widgetOptions() || "{}"),
setSaveValue(this.field.visibleCol, this.field.column().visibleCol()),
this.field.saveDisplayFormula(this.field.column()._displayColModel().formula() || '')
]);