Skip to content
\n

where root is an input of the component since it is received from an API.

\n

Current behavior is that the Tree component displays an expected root node content and even requests API to get correct child nodes based on the root data when toggling the root node. But the children are not assigned to the root.

\n

(Note: subscription to TuiTreeService data$ has been initiated inside the parent component, otherwise root component doesn't initiate API request)

","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

Hi, sorry for the long delay. Yeah, it's a bit harder than I hoped it would be. Mainly because root node is required for the service so recreating root node would require recreating service too. We could probably change root node to signal/observable so it can be updated in real time, but it's not really expected for the tree to change its root node dynamically. What you can do is provide it in the parent and only create the tree once it's available:
\nhttps://stackblitz.com/edit/angular-2e11ynqh

","upvoteCount":1,"url":"https://github.com/orgs/taiga-family/discussions/10172#discussioncomment-12221344"}}}

Asynchronous Tree component. Root node definition without using TUI_TREE_START #10172

Answered by waterplea
ne-alex asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, sorry for the long delay. Yeah, it's a bit harder than I hoped it would be. Mainly because root node is required for the service so recreating root node would require recreating service too. We could probably change root node to signal/observable so it can be updated in real time, but it's not really expected for the tree to change its root node dynamically. What you can do is provide it in the parent and only create the tree once it's available:
https://stackblitz.com/edit/angular-2e11ynqh

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ne-alex
Comment options

Answer selected by ne-alex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants