Skip to content

bug: componentDidLoad is called in parent before children have loaded #3580

@mpayson

Description

@mpayson

Prerequisites

Stencil Version

2.17.4

Current Behavior

The componentDidLoad lifecycle method is called in a parent before its children have loaded

Expected Behavior

componentDidLoad is called after all the children have loaded as described in the documentation: https://stenciljs.com/docs/component-lifecycle#lifecycle-hierarchy

Steps to Reproduce

  1. Clone the reproduction URL
  2. Install dependencies yarn
  3. Run then open the demo page yarn vite
  4. Open the developer console
  5. Notice "PARENT LOADED" is logged before "CHILD LOADED"

Note, the demo uses the index.html page and loads the built stencil components. The source code for the stencil components is in the src/ directory.

Code Reproduction URL

https://github.com/mpayson/stencil-debug

Additional Information

I was also able to reproduce this issue with another application setup (React + Webpack). Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug: ValidatedThis PR or Issue is verified to be a bug within Stencil

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions