Skip to content
New issue

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

feat(useMediaQuery): allow query to be a ref #2178

Merged
merged 3 commits into from Sep 7, 2022

Conversation

GODLiangCY
Copy link
Contributor

Description

useMediaQuery() is allowed to take a MaybeRef<string> type query as its first argument.

Also fix #2177 and related issues mentioned in it.

Additional context

Wrapping a watchEffect to update function to execute it immediately, so it ensures useMediaQuery() to have its proper initial value.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

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.

packages/core/useMediaQuery/index.ts Outdated Show resolved Hide resolved
packages/core/useMediaQuery/index.ts Outdated Show resolved Hide resolved
packages/core/useMediaQuery/index.ts Outdated Show resolved Hide resolved
@GODLiangCY
Copy link
Contributor Author

Really appreciate for your review and the work you've done, which I learn much from!@sxzz (sorry if ping directly disturbs you)
And it seems that I still have a long way to go to understand how everything works.Hope next time I can make a better PR

@okxiaoliang4 okxiaoliang4 merged commit 3309811 into vueuse:main Sep 7, 2022
@GODLiangCY GODLiangCY deleted the feat/useMediaQuery branch September 14, 2022 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useBreakpoint causes unnecessary rerenders depending on its usage
3 participants