Endless "loop" RadzenTree OnExpand

Greetings,

first of all I want to thank you for providing Radzen Blazor - great components :slight_smile:

I´m currently using the RadzenTree in "LoadOnDemand" mode to display hierarchical data.

When I try to expand a node, the page seems to be deadlocked - but if you take a look at Visual Studio (or even set a breakpoint in the assigned "OnExpand" method) it looks like an endless loop.
The breakpoint is hit again and again, although I have only clicked expand once and the output window produces:

Blockquote
SELECT [v].[KmatResID], [v].[KmatResPhaseID], [v].[LaufnrToFeatureID], [v].[PhaseLaufnrID], [v].[beschreibung], [v].[childID], [v].[ebene], [v].[familyID], [v].[kmatfamilyid], [v].[parentID], [v].[programmdetail_id], [v].[sortierung], [v].[text], [v].[type]
FROM [dbo].[V_Tree_Complete] AS [v]
WHERE [v].[parentID] = @__ToString_0
ORDER BY [v].[text]
Microsoft.EntityFrameworkCore.Database.Command: Information: Executed DbCommand (12ms) [Parameters=[@__ToString_0='?' (Size = 4000)], CommandType='Text', CommandTimeout='30']
SELECT [v].[KmatResID], [v].[KmatResPhaseID], [v].[LaufnrToFeatureID], [v].[PhaseLaufnrID], [v].[beschreibung], [v].[childID], [v].[ebene], [v].[familyID], [v].[kmatfamilyid], [v].[parentID], [v].[programmdetail_id], [v].[sortierung], [v].[text], [v].[type]
FROM [dbo].[V_Tree_Complete] AS [v]
WHERE [v].[parentID] = @__ToString_0
ORDER BY [v].[text]
Microsoft.EntityFrameworkCore.Database.Command: Information: Executed DbCommand (11ms) [Parameters=[@__ToString_0='?' (Size = 4000)], CommandType='Text', CommandTimeout='30']
SELECT [v].[KmatResID], [v].[KmatResPhaseID], [v].[LaufnrToFeatureID], [v].[PhaseLaufnrID], [v].[beschreibung], [v].[childID], [v].[ebene], [v].[familyID], [v].[kmatfamilyid], [v].[parentID], [v].[programmdetail_id], [v].[sortierung], [v].[text], [v].[type]
FROM [dbo].[V_Tree_Complete] AS [v]
WHERE [v].[parentID] = @__ToString_0
ORDER BY [v].[text]
.... And so on .... and so on ....

Here´s the tree and the code behind:

                    <RadzenTree Data="Resources" Change="@OnChange" Expand="@OnExpand" Style="width: 100%; height: 100%">
                    <RadzenTreeLevel Template="@FormatNode" TextProperty="text" />
                </RadzenTree>

                internal async Task OnExpand(TreeExpandEventArgs args)
                {

                    var child = args.Value as VTreeComplete;
                    var data = await GetChildrenAsync(child);
                    if (data != null)
                    {
                        args.Children.Data = data;
                        args.Children.TextProperty = "Text";
                        //args.Children.HasChildren = async (b) => {  return await HasChildrenAsync(b, Data.AssemblyContext.TreeLevel.ProgDetailFeature); };
                        args.Children.HasChildren = (b) => HasChildren(b, Data.AssemblyContext.TreeLevel.ProgDetailFeature);
                        args.Children.Template = FormatNode;
                    }

                }

Any idea why this happens?

Thank you in advance,

Andre

Hi @dedueand,

Welcome to the Radzen community!

This endless loop could happen if something triggers endless expanding of items for some reason. We can't determine if anything in your code is doing that though. I suggest you compare the implementation with the one from our online demo. Also I see you have a Change handler which you haven't provided - if you manually expand nodes there you may end up in this situation.

Hey,
thanks for your quick reply👍
I will check the change event tomorrow morning - but since I only show different content, depending on the node clicked, i assume that this should not be a problem.

Best regards,
Andre