Skip to content

DataGrid: extract the row update path from dataController - #34986

Open
Alyar666 wants to merge 1 commit into
DevExpress:mainfrom
Alyar666:grid_data_extract_row_update_path_26_2
Open

DataGrid: extract the row update path from dataController#34986
Alyar666 wants to merge 1 commit into
DevExpress:mainfrom
Alyar666:grid_data_extract_row_update_path_26_2

Conversation

@Alyar666

@Alyar666 Alyar666 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Moved updateRow, applyRowOperation and the applyChangeUpdate loop into
row_changes.ts as applyRowOperations: it takes the items and the plain values
instead of `this` and returns ChangedRows, which the controller attaches to
the change. applyChangeUpdate stays a thin delegate, so the editing override
keeps composing through super. Covered the engine and the delegate wiring
with jest tests.
@Alyar666
Alyar666 requested a review from a team as a code owner August 31, 2026 10:52
Copilot AI lite review requested due to automatic review settings August 31, 2026 10:52
@Alyar666 Alyar666 self-assigned this Aug 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the DataGrid row-diffing “update” path by extracting the row-operation application loop from DataController into data_controller/utils/row_changes.ts as applyRowOperations, while keeping DataController.applyChangeUpdate as a thin delegate that attaches the computed ChangedRows back onto the change object. It also introduces a typed callback (GetUpdatedColumnIndices) and adds Jest coverage for the extracted behavior and wiring.

Changes:

  • Added applyRowOperations(...) plus supporting helpers in row_changes.ts, and exported attachChangedRows(...) for reuse by the controller.
  • Simplified DataController.applyChangeUpdate(...) to compute changed row indices, delegate the mutation/reporting work to applyRowOperations, then attach the results.
  • Added/updated Jest tests covering row-operation classification/application and the applyChangeUpdate delegate behavior under key option combinations.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/devextreme/js/__internal/grids/grid_core/data_controller/utils/row_changes.ts Introduces applyRowOperations + exports attachChangedRows to decouple row update application from DataController.
packages/devextreme/js/__internal/grids/grid_core/data_controller/utils/tests/row_changes.test.ts Adds unit tests validating extracted row-operations behavior (index arithmetic, duplicates, visibility-only update, callback contract).
packages/devextreme/js/__internal/grids/grid_core/data_controller/types.ts Adds GetUpdatedColumnIndices and RowOperationOptions types used to pass the hook/options into the extracted engine.
packages/devextreme/js/__internal/grids/grid_core/data_controller/data_controller.ts Replaces inline update-loop with applyRowOperations + attachChangedRows; converts getUpdatedColumnIndices into an arrow field for safe passing as a callback.
packages/devextreme/js/__internal/grids/grid_core/data_controller/tests/data_controller.row_changes.test.ts Adds integration-style Jest tests for applyChangeUpdate wiring across repaintChangesOnly, isFullUpdate, and dataRowTemplate.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

}
}

export function applyRowOperations(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: return UpdateRowChange[], initiated with plain [] instead of initChangedRows - remove one step in utility reading

in attachChangedRows take as 2nd argument UpdateRowChange[] and convert it inside method (we already have toChangedRows, just move it inside attachChangedRows instead of argument

oldItem.update?.(newItem);
}

function updateRow(rowIndex: number, options: RowOperationOptions): UpdateRowChange {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function updates row and create UpdateRowChange instance. Let's split it, updateRow will only update data, symmetrical to applyItemChange
in fact, are those methods differ? may we use single one for both branches?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants