TreeList - DataSourceAdapter - Extract branch loading util - #35136
Open
Tucchhaa wants to merge 3 commits into
Open
TreeList - DataSourceAdapter - Extract branch loading util#35136Tucchhaa wants to merge 3 commits into
Tucchhaa wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟢 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.tsand reused it fromDataSourceAdapterTreeListto simplify the adapter implementation. - Extracted
createIdFilterhelper intoutils/create_id_filter.tsand reused it for request filter construction. - Strengthened internal types (
TreeNode.data,convertItemToNodeinput,_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.
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.
No description provided.