Skip to content

Component Life Cycle Methods not called as documented #2954

@JulianLang

Description

@JulianLang

Stencil version:

 @stencil/core@2.3.0

I'm submitting a:

[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/

Current behavior:

Consider the following structure:

<!-- toggle group A -->
<toggle-group>
   <toggle-button></toggle-button>

   <!-- nested toggle group B -->
   <toggle-group>
      <toggle-button></toggle-button>
   </toggle-group>
</toggle-group>

We have two nested toggle-groups where each should only find their own children. I rely on life-cycle hooks, so that the nested group (B) should look for its children first, mark them as "already belonging", then the next higher toggle-group (A) should search for its children (those, that are not marked yet) and so on.

Unfortunately I see the following life-cycle behavior:

ToggleGroup A:  connectedCallback
ToggleGroup B: connectedCallback
ToggleGroup A:  componentDidLoad
ToggleGroup B: componentDidLoad

which is not what I expect due to stencil's documentation.

Expected behavior:

The componentDidLoad life cycle hook gets called after all children's (slotted or not) as documented here:

So it should be:

ToggleGroup A:  connectedCallback
ToggleGroup B: connectedCallback
ToggleGroup B: componentDidLoad
ToggleGroup A:  componentDidLoad

Steps to reproduce:

  • Build a structure similar to the one given above
  • add connectedCallback and componentDidLoad to each parent-component (in my case toggle-group) with a console.log

Related code:

// insert any relevant code here

Other information:

There were already some issues about this before, but unfortunately they got closed. I hope this issue will make it, as I find it is fundamental to any component framework, that life-cycle hooks can be relied on.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions