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.
Description
This pull request introduces a minor change that enhances the Treeview component by adding lazy loading capabilities. This change does not disrupt the existing codebase and provides the ability to load child nodes dynamically when needed. The primary idea behind this commit is to determine whether a node has children and, when opening a subnode, update the external item list on behalf of the parent ID. This update is particularly useful when using a query mechanism, such as
useQuery
, for fetching data.The following code snippet demonstrates how this change can be implemented:
By utilizing this approach, the
nodeId
can be used to fetch the required data for the specific node, and subsequently, the tree nodes insidereact-dnd-treeview
can be updated. This ensures that the tree remains up-to-date with the latest nodes, improving overall performance and user experience.