Skip to content

Grids - DataController: Reuse a shared column value predicate - #35148

Open
bit-byte0 wants to merge 1 commit into
DevExpress:mainfrom
bit-byte0:refactor/reuse-command-column-predicate
Open

Grids - DataController: Reuse a shared column value predicate#35148
bit-byte0 wants to merge 1 commit into
DevExpress:mainfrom
bit-byte0:refactor/reuse-command-column-predicate

Conversation

@bit-byte0

Copy link
Copy Markdown
Contributor

What

Removes a duplicated "does this column carry a value" check from the grid data layer, replacing it with a single shared columnHasValue helper

How

The predicate is added to the columns controller utils and reused from row value generation and cell text rendering, which previously each inlined the same command/AI column check

@bit-byte0
bit-byte0 requested a review from a team as a code owner September 10, 2026 14:37
@bit-byte0 bit-byte0 added the 26_2 label Sep 10, 2026
Copilot AI lite review requested due to automatic review settings September 10, 2026 14:37
@bit-byte0 bit-byte0 self-assigned this Sep 10, 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.

🟢 Approval recommended

The change is a behavior-preserving refactor with a focused new unit test covering the extracted predicate’s intended semantics.

Pull request overview

This PR refactors the grid core data layer to remove duplicated “does this column carry a value” logic by introducing a shared columnHasValue predicate in the columns controller utils, and then reusing it in both row value generation and cell text formatting.

Changes:

  • Added a shared columnHasValue(column) helper to m_columns_controller_utils.ts.
  • Replaced duplicated inline checks in getCellText and generateRowValues with the shared helper.
  • Added Jest coverage for the new predicate, including the special-case AI column behavior.
File summaries
File Description
packages/devextreme/js/__internal/grids/grid_core/views/utils.ts Switches getCellText to use the shared columnHasValue predicate.
packages/devextreme/js/__internal/grids/grid_core/data_controller/utils/row_values.ts Switches row value generation’s “empty placeholder for command columns” logic to columnHasValue.
packages/devextreme/js/__internal/grids/grid_core/columns_controller/m_columns_controller_utils.ts Introduces the shared columnHasValue helper alongside other columns controller utilities.
packages/devextreme/js/__internal/grids/grid_core/columns_controller/tests/column_has_value.test.ts Adds Jest tests for columnHasValue (data column, command column, AI column exception).
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

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

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.

2 participants