Releases: ZeeCoder/use-resize-observer
Releases · ZeeCoder/use-resize-observer
7.0.0-alpha.1
- Added tests in real browsers with Browserstack, so that we ensure the lib
works all the way back to IE11. - [BREAKING] The returned ref is now a RefCallback, not a ref object
- [BREAKING] The returned ref will always be the same RefCallback.
Previously when a custom ref object was passed, it was returned as well from
the hook as "ref". - [BREAKING] Compared to 6.2.0-alpha.1 There's no
callbackRefreturn value
anymore.
v6.2.0-alpha.1
- Only instantiating a ResizeObserver instance if there's actually something to
observe. This for example means that if you pass innullor undefined as the
ref, or if neither the default ref or callback ref returned from the hook are
in use, then no ResizeObserver instance will get created until there's an
actual element to observe. Resolves: #42 - The hook now returns
callbackRef, which can be used in place of the usual
ref. Use this instead of a normal ref, when the observed component is
mounted with a delay. Resolves: #43, #45 - The
refoption now accepts raw elements as well. - Handling custom refs (through options), the default ref and the callback ref
has been greatly refactored internally (into theuseResolvedElement
hook), to handle more edge cases with the way refs are handled. - Tests based on react testing library were refactored to make them much simpler
and more approachable. - Fixed an error where in certain edge cases the hook tried to set state when
its host component already unmounted. - Added contributing guidelines
- Overall bundle size increased a bit, due to the new features added.
(With about ~150B or so.)
As this is an alpha release, feedback are welcome.
v6.1.0
v6.1.0-alpha.3
- Fixed SSR rendering, and added a test to cover it.
v6.1.0-alpha.2
ResizeObserver instances are no longer created unnecessarily when the onResize callback changes. (Fixes #32)
v6.1.0-alpha.1
- Rewrote the source in TypeScript. (Feedback is welcome.)
- Rewrote tests in TypeScript as well. (Ensures the types make sense.)
- Added checks to ensure small bundle size.
v6.0.0
- [BREAKING] Default width and height can now be set by declaring defaults
for object destructuring, instead of having custom options for them.
This means the following options were removed:defaultWidth,defaultHeight,
useDefaults. - [BREAKING] Due to the above, the default width and height will be
undefinedinstead of1. - Docs were updated to reflect the above changes.
- Added an
onResizehandler that can report size changes instead of the default
object return. (This also helps implementing a more performant throttle /
debounce solution.)
v5.0.0
- [BREAKING]
#14Removed the polyfill from the default builds, and shipping
it instead as as separate module. - [BREAKING]
#21Returning an object instead of an array, so that values not
needed could be omitted. - Improved ref handling:
#16You can now pass in your own ref- The same hook instance can now be reused with different refs
- The hook will no longer break if the ref is not immediately filled.
(Anything other than an object with a.currentvalue of anElementwill
be ignored.)
- Made defaults optional with the
useDefaultsoption. #18Added missing copyright notice in the MIT license.- New
package.jsonscripts to ease development - Added throttle and debounce guides to the readme
- More tests
v4.0.0
- Added option to pass default width and height. Useful when using the lib with
SSR. (Thanks Simon Boudrias and
Fokke Zandbergen) - Dep upgrades
- [BREAKING] Removed TS types. See: