Skip to content

DataGrid: refactor applyChangesOnly branch - #34937

Merged
anna-shakhova merged 2 commits into
DevExpress:mainfrom
anna-shakhova:refactor_apply_changes_only_main
Aug 28, 2026
Merged

DataGrid: refactor applyChangesOnly branch#34937
anna-shakhova merged 2 commits into
DevExpress:mainfrom
anna-shakhova:refactor_apply_changes_only_main

Conversation

@anna-shakhova

Copy link
Copy Markdown
Contributor

No description provided.

@anna-shakhova anna-shakhova self-assigned this Aug 26, 2026
@anna-shakhova
anna-shakhova force-pushed the refactor_apply_changes_only_main branch from 7042eda to 3adc3e2 Compare August 27, 2026 08:15
@anna-shakhova
anna-shakhova force-pushed the refactor_apply_changes_only_main branch from 3adc3e2 to f38316a Compare August 27, 2026 09:03
@anna-shakhova
anna-shakhova marked this pull request as ready for review August 27, 2026 09:03
@anna-shakhova
anna-shakhova requested a review from a team as a code owner August 27, 2026 09:03
Copilot AI lite review requested due to automatic review settings August 27, 2026 09:03

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 DataController.applyChangesOnly refresh/update path by extracting row-state comparisons into widget-specific extenders (editing, grouping, summary, TreeList) and by switching from a mutable ChangedRows accumulator to a list-based UpdateRowChange[] flow that is converted into an UpdateChange.

Changes:

  • Split isSameRowState logic: keep base value comparison in DataController, and move editing/grouping/summary-specific state comparisons into their respective extenders.
  • Replace the markUpdateChange/ChangedRows building flow in applyChangesOnly with UpdateRowChange[] + convertToUpdateChange.
  • Add Jest coverage for row-change detection across DataController, editing, grouping, and summary modules (plus small new utilities in grouping/summary).

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/devextreme/js/__internal/grids/grid_core/editing/extenders/editing_data_controller.ts Adds editing-specific isSameRowState override to include editing flags in row diffing.
packages/devextreme/js/__internal/grids/grid_core/editing/extenders/tests/editing_data_controller.row_changes.test.ts New tests validating editing-flag changes trigger row updates.
packages/devextreme/js/__internal/grids/grid_core/data_controller/utils/row_changes.ts Introduces convertToUpdateChange and helper conversion from UpdateRowChange[] to ChangedRows.
packages/devextreme/js/__internal/grids/grid_core/data_controller/utils/tests/row_changes.test.ts Updates tests from markUpdateChange to convertToUpdateChange and expands scenarios.
packages/devextreme/js/__internal/grids/grid_core/data_controller/data_controller.ts Refactors applyChangesOnly to produce UpdateRowChange[] and centralizes base isSameRowState to value comparison.
packages/devextreme/js/__internal/grids/grid_core/data_controller/tests/data_controller.row_changes.test.ts Adds tests validating base isSameRowState behavior (value changes vs no changes).
packages/devextreme/js/__internal/grids/grid_core/tests/mock/helpers/row_changes.ts Adds shared test helper to simulate applyChangesOnly on a single row.
packages/devextreme/js/__internal/grids/data_grid/summary/utils.ts Adds hasSummaryCells helper for summary row-state checks.
packages/devextreme/js/__internal/grids/data_grid/summary/extenders/summary_data_controller.ts Adds summary-specific isSameRowState override (summaryCells + continuation flags).
packages/devextreme/js/__internal/grids/data_grid/summary/extenders/tests/summary_data_controller.row_changes.test.ts New tests covering summary row-state change detection.
packages/devextreme/js/__internal/grids/data_grid/summary/tests/utils.test.ts Adds unit tests for hasSummaryCells.
packages/devextreme/js/__internal/grids/data_grid/grouping/utils.ts Adds grouping state comparison helpers (isSameExpandedState, isSameContinuationState).
packages/devextreme/js/__internal/grids/data_grid/grouping/m_grouping.ts Adds grouping-specific isSameRowState override for group rows.
packages/devextreme/js/__internal/grids/data_grid/grouping/extenders/tests/grouping_data_controller.row_changes.test.ts New tests validating grouping row-state change detection (including master-detail guard).
packages/devextreme/js/__internal/grids/data_grid/grouping/tests/utils.test.ts Adds unit tests for the new grouping comparison helpers.

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

Comment on lines +178 to +186
function toChangedRows(updateRowChanges: UpdateRowChange[]): ChangedRows {
return {
items: updateRowChanges
.map(({ item }) => item)
.filter((item): item is ProcessedItem => !!item),
rowIndices: updateRowChanges.map(({ rowIndex }) => rowIndex),
changeTypes: updateRowChanges.map(({ changeType }) => changeType),
columnIndices: updateRowChanges.map(({ columnIndices }) => columnIndices),
};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

current implementation keeps existing behavior

import type { ModuleType, OptionChanged } from '@ts/grids/grid_core/m_types';

import type { ProcessGroupItemsOptions } from '../../grouping/types';
import { isSameContinuationState } from '../../grouping/utils';

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.

since both summary and grouping now consume isSameContinuationState, and it's really the continuation half of isSameGroupRowState, would it fit better in grid_core/data_controller/utils so summary doesn't reach into grouping?

@anna-shakhova anna-shakhova Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is not core functionality - it could be placed in some common utils in data_grid, but still not sure about it - looks like grouping leaks into summary in some methods and vice versa grouping handles some cases for summary. They should be unbound, but it is quite big task and out of scope of this task

Also summary already imports types from grouping module


import { DATAGRID_GROUP_FOOTER_ROW_TYPE } from './const';

export function hasSummaryCells(item: ProcessedItem): boolean {

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.

hasSummaryCells reads like it checks item.summaryCells, but it's really a rowType predicate - would isSummaryRow say the intent more directly?

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.

I agree that the current name is not quite accurate.

If we need to determine which rows can have summary cells, I suggest naming it canHaveSummaryCells.

Alternatively, we could name the method isGroupRow / isGroupOrGroupFooterRow and move it to the grouping utils.

Copilot AI review requested due to automatic review settings August 28, 2026 07:27

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

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

@anna-shakhova
anna-shakhova added this pull request to the merge queue Aug 28, 2026
Merged via the queue into DevExpress:main with commit cdbfdba Aug 28, 2026
101 checks passed
@anna-shakhova
anna-shakhova deleted the refactor_apply_changes_only_main branch August 28, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants