Skip to content

Commit

Permalink
extract method refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tongsonbarbs committed Dec 9, 2024
1 parent 6457be9 commit ea1eee3
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1701,8 +1701,7 @@ class EditingControllerImpl extends modules.ViewController {
hasSavedData = !cancel;

if (!cancel && change?.type === DATA_EDIT_DATA_INSERT_TYPE) {
const result = results[i];
this._updateUnsavedRowsInsertKey(result.key, changes);
this._updateUnsavedRowsInsertKey(results[i].key, changes);
}
}
}
Expand All @@ -1714,7 +1713,7 @@ class EditingControllerImpl extends modules.ViewController {
return hasSavedData;
}

private _updateUnsavedRowsInsertKey(tempKey: any, changes: any[]) {
private _updateUnsavedRowsInsertKey(tempKey, changes: any[]) {
const topSavedRowKey = this._getTopSavedRowKey();
if (!topSavedRowKey) return;

Expand All @@ -1728,7 +1727,7 @@ class EditingControllerImpl extends modules.ViewController {
});
}

private _getTopSavedRowKey(): any {
private _getTopSavedRowKey() {
const savedRows = this._dataController.items().filter((item) => !item.isNewRow);
return savedRows.length ? savedRows[0].key : null;
}
Expand Down

0 comments on commit ea1eee3

Please sign in to comment.