Skip to content

react-simplikit@0.2.0

Latest

Choose a tag to compare

@github-actions github-actions released this 02 Sep 08:22
5a8d6db

Minor Changes

  • #446 0b66d40 Thanks @hyesungoh! - useDebouncedCallback and useThrottledCallback now accept any value type: onChange is typed (newValue: T) => void instead of (newValue: boolean) => void, so a debounced search query or a throttled scroll position no longer needs a cast. Existing boolean callers are unaffected.

    useDebouncedCallback no longer drops a first call of false. It compared incoming values against a seed of false, so the very first false looked redundant and was never forwarded; the comparison now starts from a sentinel, as useThrottledCallback already did. A false that arrives while an initial true is still pending now replaces it instead of being ignored.

    useImpressionRef no longer emits onImpressionEnd for an element that was never impressed.

Patch Changes

  • #450 a4251a3 Thanks @hyesungoh! - useDebouncedCallback and useThrottledCallback no longer forward a stale value when the caller returns to the last forwarded one. Calling with 'seo' and then 'seoul' right after 'seoul' had already been forwarded used to skip the second call as a duplicate without cancelling the pending 'seo', so onChange('seo') fired anyway. The pending call is now cancelled first. For useThrottledCallback this only showed with edges: ['trailing']; the default leading edge forwards the intermediate value immediately and masked it.

  • #452 fd312f5 Thanks @hyesungoh! - JSDoc corrections that show up in editor hover. useIntersectionObserver's options.root is typed Element | Document | null instead of boolean. useList and useSet now declare their generic parameter, their optional initial state and every member they return. mergeProps and mergeRefs mark their rest parameter as one, so the documented signature matches the implementation.

  • #456 65ce435 Thanks @mnxmnz! - Re-export the SafeAreaInset type from the package root. @react-simplikit/mobile exported it, but it was dropped when that package was absorbed into the root entry, leaving import type { SafeAreaInset } with no replacement.

  • #435 9e05182 Thanks @hyesungoh! - useDoubleClick, useGeolocation, useImpressionRef, useIntersectionObserver, useLongPress, useOutsideClickEffect, useStorageState and useVisibilityEvent are no longer marked @deprecated. They are maintained hooks again: editors stop rendering them struck-through, and no removal is planned.