Grids: remove stateStoring self extension - #34776
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors grid state storing to remove the “self extender” pattern and instead introduce a dedicated GridStateStoringController implementation shared by DataGrid/TreeList, along with stronger typing for the persisted state shape.
Changes:
- Introduces
GridState/PersistentStatetypings and a newGridStateStoringControllerto encapsulate previously extender-based controller logic. - Updates TreeList state storing to override the controller directly (instead of extending via
stateStoringModule.extenders.controllers.stateStoring). - Tightens/expands related grid typings (e.g.,
selectionFilter,expandedRowKeys, column user-state fields) and adjusts related utilities.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/devextreme/js/__internal/grids/tree_list/state_storing.ts | Switches TreeList to a dedicated controller subclass and updates module registration accordingly. |
| packages/devextreme/js/__internal/grids/grid_core/state_storing/types.ts | Adds typed definitions for persisted grid state (GridState, PersistentState). |
| packages/devextreme/js/__internal/grids/grid_core/state_storing/state_storing_module.ts | Replaces the old controller/extender wiring with the new shared controller class. |
| packages/devextreme/js/__internal/grids/grid_core/state_storing/state_storing_controller.ts | New shared controller implementation for state storing (migrated from the previous extender). |
| packages/devextreme/js/__internal/grids/grid_core/state_storing/m_state_storing.ts | Removes the old stateStoring controller extender code (now in the new controller file). |
| packages/devextreme/js/__internal/grids/grid_core/state_storing/m_state_storing_controller.ts | Improves typing and load/save flow for state persistence. |
| packages/devextreme/js/__internal/grids/grid_core/state_storing/extenders/state_storing_data_controller.ts | Extends the data controller extension contract and adjusts deferred failure typing/handling. |
| packages/devextreme/js/__internal/grids/grid_core/selection/m_selection.ts | Removes a no-longer-needed TS suppression around selectionFilter option usage. |
| packages/devextreme/js/__internal/grids/grid_core/m_types.ts | Adds selectionFilter to the internal option pick type for grid options. |
| packages/devextreme/js/__internal/grids/grid_core/data_controller/types.ts | Narrows expandedRowKeys to an array type for consistency with usage. |
| packages/devextreme/js/__internal/grids/grid_core/columns_controller/types.ts | Adds/extends column typing to match state-storing user state fields. |
| packages/devextreme/js/__internal/grids/grid_core/columns_controller/m_columns_controller_utils.ts | Adjusts field-name includes check to work with as const field arrays. |
| packages/devextreme/js/__internal/grids/grid_core/columns_controller/const.ts | Converts user-state field name lists to as const tuples for stronger typing. |
| packages/devextreme/js/__internal/core/utils/m_storage.ts | Tightens session storage helper typing. |
| packages/devextreme/js/__internal/core/m_devices.ts | Adjusts sessionStorage device override retrieval behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| } | ||
|
|
||
| const deviceOrName = sessionStorage.getItem('dx-force-device'); | ||
| const deviceOrName = sessionStorage.getItem('dx-force-device') ?? ''; |
There was a problem hiding this comment.
will be renamed to state_storing_controller_core.ts in a separate PR
| }; | ||
|
|
||
| export class GridStateStoringController extends StateStoringController<GridState> { | ||
| // eslint-disable-next-line @typescript-eslint/prefer-readonly |
There was a problem hiding this comment.
fields set in utils that are marked for refactoring, so skipped checks, as resolving readonly issue required all TODOs to be resolved first
No description provided.