Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imported component generated two class definitions and constructors get called twice #1855

Closed
aztack opened this issue Sep 9, 2019 · 1 comment
Labels

Comments

@aztack
Copy link

aztack commented Sep 9, 2019

Stencil version:

@stencil/core@1.3.3

I'm submitting a:

[x] bug report
[ ] feature request
[ ] support request

Current behavior:
Imported component compiled into two piece of code.
For example, I have comoponent which importing component

  1. TreeItem's definition inlined into tree.entry.js
  2. TreeItem also got it's own tree-item.entry.js
    When Tree component nested TreeItem(s), constructor of TreeItem in above two files both get called.

Expected behavior:

  1. Only inlined constructor get called
  2. Imported component do not generated separate entry file

Steps to reproduce:
https://github.com/aztack/nest-comp-bug

Other information:
One more redundant tree root item generated.
Two different constructors of TreeItem get called:
image

render function of TreeItem. console.log(id) get called twice. (where id is a global auto increased number for debugging purpose)
image

Seperate TreeItem definition in tree-item.entry.js:

image

Inlined TreeItem definition in tree.entry.js:

image

@ionitron-bot ionitron-bot bot added the triage label Sep 9, 2019
@aztack aztack changed the title imported component generated two class definition and constructor called twice Imported component generated two class definition and constructor called twice Sep 9, 2019
@aztack aztack changed the title Imported component generated two class definition and constructor called twice Imported component generated two class definitions and constructors get called twice Sep 9, 2019
@manucorporat
Copy link
Contributor

Why are you passing arguments in the constructor? I don’t think this could ever work... I might add an error in the compiler when creating a constructor with any argument

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants