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

fix(useElementSize): use contentBoxSize as an array in useElementSize #2520

Merged
merged 1 commit into from Jan 24, 2023

Conversation

threedayAAAAA
Copy link
Contributor

@threedayAAAAA threedayAAAAA commented Dec 8, 2022

Description

Fixes #2519

Additional context


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.

@threedayAAAAA threedayAAAAA changed the title fix #2519: use contentBoxSize as an array in useElementSize fix(contentBoxSize): use contentBoxSize as an array in useElementSize Dec 8, 2022
@threedayAAAAA threedayAAAAA changed the title fix(contentBoxSize): use contentBoxSize as an array in useElementSize fix(useElementSize): use contentBoxSize as an array in useElementSize Dec 8, 2022
width.value = boxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0)
height.value = boxSize.reduce((acc, { blockSize }) => acc + blockSize, 0)
const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize]
if (formatBoxSize) {
Copy link
Contributor

@vaakian vaakian Dec 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boxSize may be undefined, so formatBoxSize may goes [ undefined ] and go into the if block.
Put the check inside the if block would be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a good suggestion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have fixed it, please review again @vaakian

vaakian
vaakian previously approved these changes Dec 20, 2022
@threedayAAAAA
Copy link
Contributor Author

Please merge this pr @antfu

dpschen
dpschen previously approved these changes Dec 30, 2022
@MichalPniak
Copy link

Hi, when can we expect a bugfix release?

@antfu antfu merged commit 3047594 into vueuse:main Jan 24, 2023
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.

useElementSize has a bug in fireFox version 80
5 participants