v6.4.2
π Fixes
useOrientation: lockOrientation / unlockOrientation were no-ops β closes #215
Both methods guarded with if (isBrowser) return β inverted. They returned early in the browser and only proceeded during SSR, where the follow-up 'screen' in window check bailed anyway. The result: calling lockOrientation('landscape') or unlockOrientation() silently did nothing, everywhere. The guards now read if (!isBrowser) return, and the PR adds browser + SSR specs so the direction can't flip again unnoticed.
Full PR: #215
useInterval: a manually resumed interval survived unmount β closes #212
Two leaks in controls mode:
- With
controls: truethe main effect returns before registering a cleanup, so an interval started throughresume()kept firing after the component unmounted β despite the docs promising it's cleared on unmount. The cleanup now runs in its own mount-scoped effect, covering both modes without changing thedelay-update behavior. resume()overwrotetimer.currentwithout clearing the previous timer, so calling it twice left an interval that neitherpause()nor the unmount cleanup could reach. It now clears any running timer before starting a new one.
Full PR: #212
useMicrophone: level stayed frozen after stop() β closes #213
teardownAudioGraph() cancels the rAF loop, which is the only writer of level, so after stop() the value froze at whatever the last frame measured. A volume meter bound to it kept showing input long after the microphone was released. stop() now resets level to 0.
Full PR: #213
useElementByPoint: no more re-render on every frame in multiple mode β closes #214
document.elementsFromPoint() allocates a fresh array on every call, so storing its result as-is re-rendered the component on every frame of the rAF loop β even with the pointer sitting still. The hit list is now compared element-by-element inside a functional update, and the previous state is kept when nothing changed. The single-element mode needed no change: elementFromPoint() returns the same node and React bails out on its own.
Full PR: #214
Thanks @ostapondo for all four reports and fixes.
π§ Internal
- CI now runs a dedicated typecheck gate (
tsc --noEmit), and TypeScript versions are aligned across the workspace (#211). As part of it,useGeolocation's placeholder coords gained thetoJSONthatGeolocationCoordinatescarries in lib.dom.