Tags: NazoSnare/react-intersection-observer
Tags
fix: use WeakMap to avoid memory leak (thebuilder#463) IntersectionObserver roots were tracked in a Map. This ensures it's possible to reuse the Intersection Observer instance if they share the same options. Changed to use a WeakMap, so unused root elements can be garbage collected. Closes thebuilder#462
feat: add support for testing threshold values (thebuilder#417) This expands the `test-utils` to support defining a `threshold` value when checking for `isIntersecting`. Before you could only give a `boolean`. This should allow you test more complex `threshold` based scenarios.
fix: ensure thresholds is defined (thebuilder#415) Sometimes the thresholds value on the IntersectionObserver instance could be undefined. Add a fallback to a default value in the cases where the browser doesn't set it. This fixes thebuilder#414
fix: stringify array thresholds (thebuilder#404) This fixes ensures Array thresholds are converted to a string when passed to the useCallback dependency array. This prevents infinite rerenders caused by arrays being recreated every render.
feat: support initialInView (thebuilder#394) Add support for the `initialInView` option
fix: optimize InView (thebuilder#392) This changes the rendering flow in the <InView> component, optimizing it for the children. Previously it had a an internal state used to store the current inView and entry values. But it was only really used by the component when using the render props pattern. This lead to unnecessary renders for the plain component. Another optimization tried to limit the state updates, so it would only occur if inView changed. This however meant you wouldn't get the correct entry value in the render prop, since it would only update when inView changes. This would prevent you from getting the latest threshold or isVisible values.
PreviousNext