Skip to content

TreeList - DataSourceAdapter - Extract branch loading util - #35136

Open
Tucchhaa wants to merge 3 commits into
DevExpress:mainfrom
Tucchhaa:treelist-adapter-extract-branch-loading_26_2
Open

TreeList - DataSourceAdapter - Extract branch loading util#35136
Tucchhaa wants to merge 3 commits into
DevExpress:mainfrom
Tucchhaa:treelist-adapter-extract-branch-loading_26_2

Conversation

@Tucchhaa

Copy link
Copy Markdown
Contributor

No description provided.

@Tucchhaa Tucchhaa self-assigned this Sep 10, 2026
Copilot AI lite review requested due to automatic review settings September 10, 2026 04:09
@Tucchhaa
Tucchhaa requested a review from a team as a code owner September 10, 2026 04:09
@Tucchhaa Tucchhaa added the 26_2 label 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 refactor preserves the existing behavior, adds targeted Jest coverage for the extracted logic (including the race-condition scenario), and the typing changes are consistent with current runtime usage.

Pull request overview

Refactors TreeList’s data source adapter to extract the “load missing parent/child branches” logic into a dedicated utility, while tightening internal typing around RawItemData for nodes and cached store data.

Changes:

  • Extracted branch loading logic into utils/load_branches.ts and reused it from DataSourceAdapterTreeList to simplify the adapter implementation.
  • Extracted createIdFilter helper into utils/create_id_filter.ts and reused it for request filter construction.
  • Strengthened internal types (TreeNode.data, convertItemToNode input, _cachedStoreData / setCachedStoreData) and added Jest coverage for branch-loading behavior and race-condition protection.
File summaries
File Description
packages/devextreme/js/__internal/grids/tree_list/data_source_adapter/utils/nodes.ts Tightens convertItemToNode input type to RawItemData for safer internal node construction.
packages/devextreme/js/__internal/grids/tree_list/data_source_adapter/utils/load_branches.ts New extracted utility implementing parent/child branch loading with operation-staleness guarding and cache updates.
packages/devextreme/js/__internal/grids/tree_list/data_source_adapter/utils/create_id_filter.ts New shared helper to build an or-combined ID filter for store loading.
packages/devextreme/js/__internal/grids/tree_list/data_source_adapter/utils/tests/load_branches.test.ts Adds focused Jest coverage for parent/child loading, caching behavior, long-filter fallback, and failure paths.
packages/devextreme/js/__internal/grids/tree_list/data_source_adapter/types.ts Narrows TreeNode.data type to RawItemData.
packages/devextreme/js/__internal/grids/tree_list/data_source_adapter/m_data_source_adapter.ts Replaces in-class branch loading with loadBranches, and reuses createIdFilter; adds a TS suppression for an array meta-property.
packages/devextreme/js/__internal/grids/tree_list/data_source_adapter/m_data_source_adapter.test.ts Updates the existing race-condition test to target the extracted loadBranches path.
packages/devextreme/js/__internal/grids/grid_core/data_source_adapter/m_data_source_adapter.ts Tightens _cachedStoreData and setCachedStoreData typing and updates a concat site with an explicit cast.
Review details
  • Files reviewed: 8/8 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