bug: mutating an immutable property calls related watcher functions w/ new value #3490
Open
3 tasks done
Labels
Resolution: Refine
This PR is marked for Jira refinement. We're not working on it - we're talking it through.
Prerequisites
Stencil Version
2.17.2
Current Behavior
When decorating a function with a
@Watch
decorator for an immutable property, and changing that property internally, the watcher function is still called despite the property being immutable.Example
I have the following immutable (by default) property and watcher on that property:
If I have a method which mutates
myVar
internally, the watcher function is subsequently called.If I then call
mutateImmutableProperty
,watchMyVar
is subsequently called because the value ofmyVar
is updated:However,
myVar
is immutable (mutable: false
- by default) therefore, I would question if it's correct to call subsequent watcher functions.Expected Behavior
For the
@Watch
er functions to not be called on immutable properties when they are modified internally.Steps to Reproduce
onClick
event of a button:Code Reproduction URL
https://github.com/kelvindart/stencil-watcher-bug
Additional Information
The text was updated successfully, but these errors were encountered: