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

Props not available in life-cycle hooks in custom elements #4716

Closed
akibrk opened this issue Oct 1, 2021 · 4 comments
Closed

Props not available in life-cycle hooks in custom elements #4716

akibrk opened this issue Oct 1, 2021 · 4 comments
Assignees
Labels
❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. 🐞 bug Something isn't working scope: custom elements

Comments

@akibrk
Copy link

akibrk commented Oct 1, 2021

Version

3.2.19

Reproduction link

github.com

Steps to reproduce

General

  1. Create a custom element
  2. Try using the life-cycle hooks to access the props.

Reproduction through the example

  1. Clone the repo provided
  2. Run npm i --save
  3. Run npm run build:wc
  4. Copy the output into lab directory
  5. cd lab then run npx http-server

What is expected?

Expected props to be available in created/mounted/before mount hooks.

What is actually happening?

Props are undefined in setup/onMounted/onBeforeMount or created hooks


This is happening in the defineCustomElement API.
Also, it says the attributes have not been passed in console warning, even though the attributes have been passed in.

@akibrk akibrk changed the title Props not available life-cycle hooks in custom elements Props not available in life-cycle hooks in custom elements Oct 1, 2021
@akibrk
Copy link
Author

akibrk commented Oct 12, 2021

Anything on this?

@flanagankp
Copy link

I believe I'm seeing the same problem:
#4789

@LinusBorg LinusBorg added ❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. 🐞 bug Something isn't working labels Oct 13, 2021
@LinusBorg LinusBorg self-assigned this Oct 13, 2021
@LinusBorg
Copy link
Member

I'll send a PR in a few hours

@yyx990803
Copy link
Member

fixed by 3ca8317

@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. 🐞 bug Something isn't working scope: custom elements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants