Skip to content

Allow Children with the Same Key to Vary in Type #613

Closed
@rmorshea

Description

@rmorshea

Current Situation

Right now, if an element starts out as a component, it can't be converted to a component later. For example,

from idom import component, html

@component
def First():
    if condition:
        return html.div()
    else:
        return Second()

@component
def Second():
    ...

This will result in either of the following errors:

Initially I introduced those errors because I imagined that this scenario would be uncommon or that if it did one would want to avoid changing from a standard element to a component. The simplicity of the case above though demonstrates how common and useful this case might be.

Proposed Actions

All the above described usage. The logic inside the layout is getting complex enough that it may warrant refactoring at some point to make it easier to understand. Right now there's a lot of mutation that goes on which is hard to follow.

Work Items

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority-2-moderateShould be resolved on a reasonable timeline.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions