Grids: create dataSourceController - #35040
Conversation
6aba1f7 to
bc02336
Compare
bc02336 to
86bce1c
Compare
There was a problem hiding this comment.
🟡 Changes recommended
DataController assigns/uses this.dataSourceController without declaring the field, which is a TypeScript compile/lint error.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Introduces a new dataSource controller/module in the shared grid core to encapsulate access to the DataSourceAdapter, and wires it into both DataGrid and TreeList so other controllers can depend on it consistently.
Changes:
- Added
DataSourceController+dataSourceModuleingrid_coreand exposed it viaControllers['dataSource']. - Registered the new
dataSourcemodule (and placed it first in module order) for both DataGrid and TreeList. - Added Jest unit + integration coverage, and updated grid test mocks to always include the new leaf module.
File summaries
| File | Description |
|---|---|
| packages/devextreme/testing/helpers/gridBaseMocks.js | Ensures dataSource module is always included in mock module setup. |
| packages/devextreme/js/__internal/grids/tree_list/module_not_extended/data_source.ts | Registers dataSourceModule for TreeList. |
| packages/devextreme/js/__internal/grids/tree_list/m_widget_base.ts | Imports TreeList dataSource module and adds it to modules order. |
| packages/devextreme/js/__internal/grids/grid_core/m_types.ts | Adds dataSource to the Controllers interface. |
| packages/devextreme/js/__internal/grids/grid_core/data_source/data_source_module.ts | Defines the dataSourceModule mapping to DataSourceController. |
| packages/devextreme/js/__internal/grids/grid_core/data_source/data_source_controller.ts | Implements a controller wrapper around the DataSourceAdapter. |
| packages/devextreme/js/__internal/grids/grid_core/data_source/tests/data_source_controller.test.ts | Unit tests for controller delegation and adapter lifecycle semantics. |
| packages/devextreme/js/__internal/grids/grid_core/data_source/tests/data_source_controller.integration.test.ts | Integration tests verifying module registration/order and runtime linkage with DataController. |
| packages/devextreme/js/__internal/grids/grid_core/data_controller/data_controller.ts | Caches the new controller and pushes adapter updates into it. |
| packages/devextreme/js/__internal/grids/data_grid/module_not_extended/data_source.ts | Registers dataSourceModule for DataGrid. |
| packages/devextreme/js/__internal/grids/data_grid/m_widget_base.ts | Imports DataGrid dataSource module and adds it to modules order. |
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟢 Approval recommended
The new controller is consistently registered in both grids, adapter synchronization is correctly wired through the single _dataSource assignment point, and the PR includes focused unit and integration coverage for behavior and registration.
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 0 new
- Review effort level: Lite
There was a problem hiding this comment.
🟢 Approval recommended
The module wiring is consistent across DataGrid/TreeList and the adapter lifecycle change is backed by both unit and integration Jest coverage.
Review details
- Files reviewed: 13/13 changed files
- Comments generated: 0 new
- Review effort level: Lite
There was a problem hiding this comment.
🟢 Approval recommended
The refactor cleanly centralizes adapter creation behind a new controller, updates callers/tests accordingly, and adds both unit and integration coverage for the new module wiring.
Review details
- Files reviewed: 17/17 changed files
- Comments generated: 0 new
- Review effort level: Lite
There was a problem hiding this comment.
🟡 Changes recommended
The updated DataGrid QUnit test directly mutates a private controller field and TreeList’s new module uses an inconsistent core import style that should be corrected before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
packages/devextreme/js/__internal/grids/tree_list/data_source/data_source_module.ts:1
- In TreeList internals, modules consistently import the core via relative paths (e.g.
../m_coreintree_list/editing/m_editing.ts:18). This file is the only one using the@ts/grids/tree_list/m_corealias, which makes imports inconsistent and harder to grep/relocate within the folder.
- Files reviewed: 19/19 changed files
- Comments generated: 1
- Review effort level: Lite
There was a problem hiding this comment.
🔵 Needs a closer look
TreeList’s new dataSource module/controller introduce inconsistent module import specifiers compared to established TreeList conventions, which should be aligned before merging to avoid module-resolution edge cases.
Review details
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
packages/devextreme/js/__internal/grids/tree_list/data_source/data_source_controller.ts:3
- TreeList implementation files generally reference the local data source adapter via a relative path (e.g. tree_list/data_source_adapter/m_data_source_adapter.ts is imported from other TreeList modules as "../data_source_adapter/m_data_source_adapter"). Aligning this new controller with that pattern avoids inconsistent module specifiers and reduces the chance of bundler alias/relative duplication issues.
packages/devextreme/js/__internal/grids/tree_list/data_source/data_source_module.ts:1 - In the TreeList codebase, modules typically import the local core via a relative path (e.g. tree_list/data_controller/m_data_controller.ts:8 and tree_list/data_source_adapter/m_data_source_adapter.ts:20 use "../m_core"). Using the
@tsalias here introduces an inconsistent import pattern and can risk duplicate module instances if alias/relative resolution diverges in the build pipeline. Consider switching this to a relative import like the rest of the TreeList modules.
- Files reviewed: 19/19 changed files
- Comments generated: 0 new
- Review effort level: Lite
No description provided.