Skip to content

[Feature]: Recursive For Loops #518

Description

Before filing

  • I searched existing issues and did not find a duplicate.

Area

None

Problem or need

To be able to recursively render a tree list, if the initial state has:

{
  items: [
     {
        name: "Colors",
        children: [
             {   name: "Ali" },
             {   name: "Alice" },
             {   name: "Bob" },
         ]
     },
     {
        name: "Name",
        children: [
         ]
     },
     {
        name: "Hobbies",
        children: [
             {
                  name: "Sports",
                  children: [
                    {   name: "Futbol" },
                    {   name: "Cricket" },
                  ] 
             }
         ]
     },
  ]
}

We need the structure to support how we did the original prototype

<ul>
  <for each="{{child in items}}" template="tree-item">
    <li>{{child.name}}</li>
    <if condition="{{child.children}}">
      <ul>
        <for template="tree-item" each="{{child in child.children}}" />
      </ul>
     </if>
   </for>
</ul>

Who would benefit?

Recursive trees

Desired outcome

No response

Concrete example

No response

Constraints

No response

Alternatives or workarounds

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions