-
Notifications
You must be signed in to change notification settings - Fork 815
Description
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:
- https://stenciljs.com/docs/component-lifecycle#componentdidload
- https://stenciljs.com/docs/component-lifecycle#lifecycle-hierarchy
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
andcomponentDidLoad
to each parent-component (in my case toggle-group) with aconsole.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.