Skip to content

Cannot read properties of undefined (reading 'parentNode') with recursive FluentTreeView #1289

@verdie-g

Description

@verdie-g

🐛 Bug Report

When generating a FluentTreeView using a recursive function, only the first item is rendered and it throws Cannot read properties of undefined (reading 'parentNode') on click.

💻 Repro or Code Sample

<FluentTreeView>
@{
    RenderTree(0, 3);

    void RenderTree(int depth, int maxDepth)
    {
        if (depth >= maxDepth)
        {
            return;
        }

        <FluentTreeItem Text="item">
            @{ RenderTree(depth + 1, maxDepth); }
        </FluentTreeItem>
    }
}
</FluentTreeView>

🤔 Expected Behavior

I expect a tree to be generate with 3 levels of items and that the click to expand works.

😯 Current Behavior

Only the first item is generated and it throws this on click

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: TypeError: Cannot read properties of undefined (reading 'parentNode')
TypeError: Cannot read properties of undefined (reading 'parentNode')

🔦 Context

I have a tree data structure and I'm trying to display it using a FluentTreeView.

🌍 Your Environment

  • OS & Device: Windows on PC
  • Browser: Google Chrome
  • .NET: 8.0.1
  • Microsoft.FluentUI.AspNetCore.Components: 4.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions