feat(whenever): allow array sources #5151
Open
+109
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before submitting the PR, please make sure you do the following
fixes #123).Description
The vue
watchfunction allows an array ofWatchSources to be passed as the watch source, and it then triggers on any of the items in the array changing.wheneverdirectly passes thesourcetowatchbut the typing & subsequent callback do not support arrays.This PR adds typing for arrays and only fires the callback if any of the array items are truthy. If none of the items in the array are truthy then it does not fire the callback.
Additional context
Should there be an option to only fire the callback if every array item is truthy?
If so, which should be the default?
There is a similar PR #5096 focused on the
oldValuetyping. Although my PR doesn't make the same changes, it does conflict so (presuming both PRs are accepted) it might be worth me and @VChet getting our changes together into a single PR?