Why is it necessary to determine variables such as forceTrigger in the doWatch function when it has already been determined that the current ReactiveEffect is' Dirty '? #10550
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The effect being dirty means that one or more of the effect's reactive dependencies changed. That does not necessarily mean that the effect's result itself will change. And in the case of The second if-check is checking weither or not to run the callback. |
Beta Was this translation helpful? Give feedback.
The effect being dirty means that one or more of the effect's reactive dependencies changed. That does not necessarily mean that the effect's result itself will change.
And in the case of
watch
, the first argument is the effect, the second argument is the callback (cb
) - and we only want to run the callback if the effect's return value actually changed (or we need to run it regardless, i.e. whendeep: true
is set).The second if-check is checking weither or not to run the callback.
Demo Playground