Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Flambe
Copy link

@Flambe Flambe commented Nov 5, 2025

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.
⚠️ Slowing down new functions

Warning: Slowing down new functions

As the VueUse audience continues to grow, we have been inundated with an overwhelming number of feature requests and pull requests. As a result, maintaining the project has become increasingly challenging and has stretched our capacity to its limits. As such, in the near future, we may need to slow down our acceptance of new features and prioritize the stability and quality of existing functions. Please note that new features for VueUse may not be accepted at this time. If you have any new ideas, we suggest that you first incorporate them into your own codebase, iterate on them to suit your needs, and assess their generalizability. If you strongly believe that your ideas are beneficial to the community, you may submit a pull request along with your use cases, and we would be happy to review and discuss them. Thank you for your understanding.


Description

The vue watch function allows an array of WatchSources to be passed as the watch source, and it then triggers on any of the items in the array changing. whenever directly passes the source to watch but 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.

// before
function doSomething() {
  // ...
}

whenever(valueA, doSomething)
whenever(valueB, doSomething)

// after
whenever([valueA, valueB], () => {
  // ...
})

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 oldValue typing. 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?

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Nov 5, 2025
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants