Skip to content

renderComponent should automatically cleanup if the parentElement (the element passed to into) is removed from the DOM #21097

@NullVoxPopuli

Description

@NullVoxPopuli

🐞 Describe the Bug

Currently, it looks like we'd use this

without this, users need to to manually call destroy (available on renderComponent's return value)

e.g.:

let { destroy } = renderComponent('...', { into: x });

// time passes

destroy();

vs

renderComponent('...', { into: x });

x.remove();

// component is destroyed for you (async)
// (desired, but not happening today)

This could also happen if you remove all of the children

x.innerHTML = '';

should trigger cleanup

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions