mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Renaming column by clicking away resulted in renaming different column.
Summary: Bug summary: if in right bar user starts changing name of column, but then clicks on a different column name in table, THAT column will have its name changed. This bug occurs because the save method is invoked by a blur event on a input field, which is triggered after all computed observables are calculated. Save method gets an observable to update, which by the time a blur event triggers, is changed to a new column. The solution was to forcefully trigger the blur event as soon as possible - here by subscribing to the cursor position observable. Test Plan: Browser tests Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2845
This commit is contained in:
@@ -195,11 +195,17 @@ export class RightPanel extends Disposable {
|
||||
// Builder for the reference display column multiselect.
|
||||
const refSelect = owner.autoDispose(RefSelect.create({docModel, origColumn, fieldBuilder}));
|
||||
|
||||
// build cursor position observable
|
||||
const cursor = owner.autoDispose(ko.computed(() => {
|
||||
const vsi = this._gristDoc.viewModel.activeSection().viewInstance();
|
||||
return vsi?.cursor.currentPosition() ?? {};
|
||||
}));
|
||||
|
||||
return domAsync(imports.loadViewPane().then(ViewPane => {
|
||||
const {buildNameConfig, buildFormulaConfig} = ViewPane.FieldConfig;
|
||||
return dom.maybe(isColumnValid, () =>
|
||||
buildConfigContainer(
|
||||
dom.create(buildNameConfig, origColumn),
|
||||
dom.create(buildNameConfig, origColumn, cursor),
|
||||
cssSeparator(),
|
||||
dom.create(buildFormulaConfig, origColumn, this._gristDoc, this._activateFormulaEditor.bind(this)),
|
||||
cssSeparator(),
|
||||
|
||||
Reference in New Issue
Block a user