react-use icon indicating copy to clipboard operation
react-use copied to clipboard

fix(useMeasure): allow null element

Open veloek opened this issue 5 years ago • 3 comments

Description

With strictNullChecks enabled in typescript UseMeasureRef complains that it's being passed something that may be null.

It's already checking for nulls with if (!element) return;, so it should be no problem changing the type to allow it.

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as before)

Checklist

  • [x] Read the Contributing Guide
  • [x] Perform a code self-review
  • [ ] Comment the code, particularly in hard-to-understand areas
  • [ ] Add documentation
  • [ ] Add hook's story at Storybook
  • [ ] Cover changes with tests
  • [x] Ensure the test suite passes (yarn test)
  • [ ] Provide 100% tests coverage
  • [x] Make sure code lints (yarn lint). Fix it with yarn lint:fix in case of failure.
  • [x] Make sure types are fine (yarn lint:types).

veloek avatar Aug 20 '20 09:08 veloek

@streamich This has been open for a while now... Are there any blockers or could it get merged soon?

veloek avatar Sep 23 '22 12:09 veloek

I'd give up on this one if I were you :cry: https://github.com/streamich/react-use/issues/1974

image

I've been using https://react-hookz.github.io/web/?path=/docs/sensor-usemeasure--example for a while now, and it works like a charm :wink:

axelboc avatar Sep 23 '22 12:09 axelboc

Yeah, I just got caught up on the discussion about forking/starting over with react-hookz/web and I see that this project is a dead end. I'll see if I can find some time to migrate then...

veloek avatar Sep 23 '22 12:09 veloek