react-component / react-component/tree-select
Dynamic Load Data does not render children on expand
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 312
- Forks
- 204
- Avg merge
- 37m
- Merged PRs (30d)
- 1
Description
I am following the dynamic.html example and have a handler for the loadData property. In this handler we are dynamically fetching the children and inserting them in the "children" property of the appropriate node in the treeData array that is in the State object of our component that is embedding TreeSelect.
Here are some snippets of code:
Render method:
render() {
this.disableCurrNode(this.state.treeData);
return (
<TreeSelect
style={{ width: '100%' }}
dropdownStyle={{ maxHeight: 200, overflow: 'auto' }}
placeholder={this.props.intl.formatMessage(messages.searchFolderPlaceholder)}
treeIcon={true}
treeCheckable={false}
showSearch={false}
multiple={false}
inputValue={null}
value={this.state.value}
treeData={this.state.treeData}
treeDataSimpleMode={false}
onChange={this.onChange}
loadData={this.onLoadData}
/>
);
}
Load Data hander:
onLoadData = (treeNode) => {
return new Promise((resolve) => {
const self = this;
const entityId = treeNode.props.value;
const token = this.props.token;
$.getJSON(/box-admin/box-ui-proxy/treeChildFolders/${ entityId }?token=${ token}, (data) => {
const treeData = self.state.treeData;
self.recursiveAddChildren(entityId, treeData, data.items);
self.disableCurrNode(treeData);
self.setState({
treeData
});
resolve();
});
});
};
The TreeSelect is in a react modal dialog, the first time the tree is expanded it does not show the children, but if I subsequently close the dialog and open again it show the children.
The following screenshots shows the issue:
First Time the Tree Node is expanded (Collaboration Test):

Second Time the Tree node is expanded (Collaboration Test):

Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the dynamic.html example and the TreeSelect loadData behavior described in the report. Reproduce the React modal case by expanding a node for the first time, then inspect how asynchronously inserted children reach treeData and are rendered. Done means the fetched children appear on the initial expansion, without closing and reopening the dialog.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100