-
Notifications
You must be signed in to change notification settings - Fork 795
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
bug: esnext target (Public Instance Fields) breaks State props rerendering #3130
Comments
Thank you for the detailed report and the reproduction repo! I flagged this to be validated and @rwaskiewicz will follow up with next steps. |
Hey @bashmish, I've confirmed this bug. It appears to be the result of Stencil not handling
Either way, I'm going to label this so that it gets ingested into our backlog to get looked at in the near future. Thanks for such a detailed bug report and repro, the team and I really appreciate it! ❤️ |
@rwaskiewicz I confirm good to mention my use case, because I'm limited in what I can do there with export declare const transpile: (code: string, opts?: TranspileOptions) => Promise<TranspileResults>;` so I can't just pass the ideally I want to be able to just pass the whole |
Thanks @bashmish, that definitely helps, both from a context standpoint and as a separate feature request. CC'ing the Stencil product manager, @splitinfinities, for visibility |
|
This has been fixed in Stencil v2.19.0, which was just released. I'm going to close this issue as a result. If this bug should reappear, feel free to open a new issue. Thanks! |
Thanks, great job 🤩 I especially like the explainer in the commit message, very clear and detailed, I'm gonna refer to this as an example how to maintain good and healthy history. |
Prerequisites
Stencil Version
2.10.0
Current Behavior
updates of the
@State
props don't trigger rerendering whentsconfig.json
sets target toesnext
, because Public Instance Field for@State
is shadowing getters/setters defined by StencilJS to observe state changesExpected Behavior
state updates trigger rerendering
Steps to Reproduce
Just clone https://github.com/bashmish/bug-stenciljs-state-public-field-esnext,
npm install && npm start
and play with+
-
buttons.Or:
npm init stencil
compilerOptions.target
toesnext
intsconfig.json
(activates Public Instance Fields in modern browsers)@State
prop and some logic to update it and display in the DOM new value (in my repo I use a simple counter example)Code Reproduction URL
https://github.com/bashmish/bug-stenciljs-state-public-field-esnext
Additional Information
Suddenly this problem doesn't happen for
@Prop
in exactly the same situation.I debugged why and found this code which remove the shadowing property from the component instance here https://github.com/ionic-team/stencil/blob/16b8ea4dabb22024872a38bc58ba1dcf1c7cc25b/src/runtime/connected-callback.ts#L84
I assume you can use a similar approach for
@State
and maybe explicitly for@Prop
too, because this code purpose seems to be different.The text was updated successfully, but these errors were encountered: