We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
https://tdrol.github.io/stencil-custom-elements-watch-bug/
Stencil version:
@stencil/core@1.14.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:
In code build as dist-custom-elements-bundle output, @Watch decorated methods are not executed when watched attribute is changed dynamically.
dist-custom-elements-bundle
@Watch
Expected behavior:
Methods decorated with @Watch should be executed on attribute change in code generated by as dist-custom-elements-bundle output.
Steps to reproduce:
npm install
npm run build
dist/
dist/index.html
watchCallCount=...
Demo
Related code:
@Component({ tag: 'my-component', shadow: true }) export class MyComponent { @Prop() prop: string = '0'; @State() watchCallCount = 0; @Watch('prop') updateProp() { this.watchCallCount++ } render() { return <pre>prop={this.prop}; watchCallCount={this.watchCallCount}</pre>; } }
<my-component prop="0"></my-component> <button onclick="document.querySelector('my-component').setAttribute('prop', Date.now());">Change prop</button>
Other information:
Watchers are executed only if isWatchReady flag is set on the component (src/runtime/set-value.ts#L50), but this flag is set only when build target has either lazyLoad or hydrateClientSide set to true (src/runtime/initialize-component.ts#L29) and dist-custom-elements-bundle target has both of them set to false (src/compiler/output-targets/dist-custom-elements-bundle/custom-elements-build-conditionals.ts)
isWatchReady
lazyLoad
hydrateClientSide
true
false
The text was updated successfully, but these errors were encountered:
Thank you for putting together a great repo case! We'll get this fixed up and in the next release
Sorry, something went wrong.
d052fe4
No branches or pull requests
https://tdrol.github.io/stencil-custom-elements-watch-bug/
Stencil version:
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:
In code build as
dist-custom-elements-bundle
output,@Watch
decorated methods are not executed when watched attribute is changed dynamically.Expected behavior:
Methods decorated with
@Watch
should be executed on attribute change in code generated by asdist-custom-elements-bundle
output.Steps to reproduce:
npm install
andnpm run build
dist/
folder and opendist/index.html
watchCallCount=...
valuesDemo
Related code:
Other information:
Watchers are executed only if
isWatchReady
flag is set on the component (src/runtime/set-value.ts#L50), but this flag is set only when build target has eitherlazyLoad
orhydrateClientSide
set totrue
(src/runtime/initialize-component.ts#L29) anddist-custom-elements-bundle
target has both of them set tofalse
(src/compiler/output-targets/dist-custom-elements-bundle/custom-elements-build-conditionals.ts)The text was updated successfully, but these errors were encountered: