Grids - DataController: Reuse a shared column value predicate - #35148
Open
bit-byte0 wants to merge 1 commit into
Open
Grids - DataController: Reuse a shared column value predicate#35148bit-byte0 wants to merge 1 commit into
bit-byte0 wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟢 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 tom_columns_controller_utils.ts. - Replaced duplicated inline checks in
getCellTextandgenerateRowValueswith 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Removes a duplicated "does this column carry a value" check from the grid data layer, replacing it with a single shared
columnHasValuehelperHow
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