Skip to content

Directive hooks are inconsistent for components with comment nodes #5407

@NoelDeMartin

Description

Version

3.2.25

Reproduction link

stackblitz.com

Steps to reproduce

Create a component with a text node in the top level of the template, and attach a custom directive to debug mounted/unmounted hooks.

What is expected?

I expected hooks to work normally, or if they didn't to throw a warning like it happens for components with multiple root nodes.

What is actually happening?

The first mounted hook seems to work fine, but then unmounted hooks don't work and mounted are called twice.


In case you're wondering why would I need this, sometimes I write <!-- TODO ... --> at the top of component templates and that's how I came across this issue. It wasn't easy to pinpoint the source of the problem, so this may bite other people as well.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions