(core) Fix bug causing cursor to jump to first row in a widget linked to a summary table.

Summary:
When editing data in a table linked to its summary, if the edit results in an
update to the summary table, the cursor was jumping to the first row in the
linked table.

This is visible, for example, in the template
https://templates.getgrist.com/2i9WoHs2oRzK/Credit-Card-Activity-Template-AmEx/p/2
if editing "Amount" in the "ACTIVITY" widget (because that causes an update in
"ACTIVITY [by Category]").

The fix removes the offending line which seems unneeded: group-by columns in
summary tables don't change for an existing row, so there is no need to watch
the summary table for changes.

Test Plan: Adds a test case that fails without the fix, and passes with it.

Reviewers: jarek

Reviewed By: jarek

Subscribers: cyprien

Differential Revision: https://phab.getgrist.com/D3674
This commit is contained in:
Dmitry S 2022-10-20 01:35:11 -04:00
parent 6460c22a89
commit 82eb5b3f76

View File

@ -107,9 +107,8 @@ export class LinkingState extends Disposable {
this.filterColValues = this.autoDispose(ko.computed(() => _filterColValues())); this.filterColValues = this.autoDispose(ko.computed(() => _filterColValues()));
// source data table could still be loading (this could happen after changing the group by // source data table could still be loading (this could happen after changing the group by
// columns of a linked summary table for instance), hence the below listeners. // columns of a linked summary table for instance), hence the below listener.
this.autoDispose(srcTableData.dataLoadedEmitter.addListener(_update)); this.autoDispose(srcTableData.dataLoadedEmitter.addListener(_update));
this.autoDispose(srcTableData.tableActionEmitter.addListener(_update));
_update(); _update();
function _update() { function _update() {