Skip to content

Releases: sheinsight/react-use

v1.7.0

11 Sep 09:07
Compare
Choose a tag to compare

   🚀 Features

  • Add new Hook useForm to handle form state, both for controlled and uncontrolled forms  -  by @vikiboss (44137)
  • Add new Hook useWebSocket to handle WebSocket connections  -  by @vikiboss (edc56)
  • Add new Hook useVersionedAction to run versioned action  -  by @vikiboss (f34bf)
  • Add new Hook usePagingList to handle paging list  -  by @vikiboss (a3b15)
  • Add new Hook useInfiniteList to handle infinite list  -  by @vikiboss (1538c)
  • useInfiniteScroll:
    • Add reset method to reset state & fix horizontal scroll issue  -  by @vikiboss (37ddd)
    • Add loadMore method to load more manually & reset to reset, deprecated isLoading, prefer loading  -  by @vikiboss (20d4f)
  • useMultiSelect:
    • Add unselect and unselectAll, deprecated unSelect and unSelectAll.  -  by @vikiboss (26142)
  • usePagination:

   🐞 Bug Fixes

  • useInfiniteScroll:
    • Use useLatest to avoid expired callbacks  -  by @vikiboss (1e816)
    • Fix not loading when it has more space to scroll after first load  -  by @vikiboss (c4036)
  • useMultiSelect:
  • useQuery:
    • Fix internal behavior params missing bug (should run refresh, not run)  -  by @vikiboss (3fbfb)
    • Fix useQuery run method return value when throttle and debounce are not set  -  by @vikiboss (2f25b)
    View changes on GitHub

🚀 功能新增

  • 新增 useForm Hook,用于处理表单状态,适用于受控与非受控表单  -  由 @vikiboss 提供 (44137)
  • 新增 useWebSocket Hook,用于处理 WebSocket 连接  -  由 @vikiboss 提供 (edc56)
  • 新增 useVersionedAction Hook,用以执行基于版本的动作  -  由 @vikiboss 提供 (f34bf)
  • 新增 usePagingList Hook,用于处理分页列表  -  由 @vikiboss 提供 (a3b15)
  • 新增 useInfiniteList Hook,用于处理无限列表  -  由 @vikiboss 提供 (1538c)
  • useInfiniteScroll:
    • 新增 reset 方法重置状态 & 修复横向滚动问题  -  由 @vikiboss 提供 (37ddd)
    • 新增 loadMore 方法手动加载更多 & reset 重置,弃用 isLoading,推荐使用 loading  -  由 @vikiboss 提供 (20d4f)
  • useMultiSelect:
    • 新增 unselectunselectAll,弃用 unSelectunSelectAll。  -  由 @vikiboss 提供 (26142)
  • usePagination:

🐞 修复

  • useInfiniteScroll:
    • 使用 useLatest 避免过期的回调函数  -  由 @vikiboss 提供 (1e816)
    • 修复首次加载后仍有更多空间可滚动时不触发加载的问题  -  由 @vikiboss 提供 (c4036)
  • useMultiSelect:
  • useQuery:
    • 修复内部行为参数缺失的错误(应执行 refresh,而非 run) -  由 @vikiboss 提供 (3fbfb)
    • 修复当未设置 throttledebounce 时 useQuery run 方法的返回值问题  -  由 @vikiboss 提供 (2f25b)
在 GitHub 上查看更改

v1.6.0

29 Aug 08:11
Compare
Choose a tag to compare

   🚀 Features

  • Add new Hook useVirtualList to improve large list render performance, support both vertical and horizontal mode.  -  by @vikiboss (429cc)
  • Add exports for package.json  -  by @vikiboss (df087)

   🐞 Bug Fixes

  • useInfiniteScroll: Fix isLoading & isLoadDone state not update expectedly  -  by @vikiboss (3ef21)
  • useQuery: Fix refresh not controlled by debounce and throttle options  -  by @vikiboss (701c7)
    View changes on GitHub

🚀 功能特性

  • 新增 useVirtualList Hook,用于提升大型列表的渲染性能,支持垂直和水平模式。 -  由 @vikiboss 提供 (429cc)
  • package.json 中添加了导出项。 -  由 @vikiboss 提供 (df087)

🐞 修复的错误

  • useInfiniteScroll:修复了 isLoadingisLoadDone 状态更新不如预期的问题。 -  由 @vikiboss 提供 (3ef21)
  • useQuery:修复了 refresh 功能不受 debouncethrottle 选项控制的问题。 -  由 @vikiboss 提供 (701c7)
    在 GitHub 上查看更改

v1.5.0

21 Aug 02:42
Compare
Choose a tag to compare

   🚀 Features

  • Add new Hook useQuery renamed from useRequest  -  by @vikiboss (11f65)

  • Add internal Hooks useTrackedRefState & useVersionedAction  -  by @vikiboss (783fa)

  • Add new Hook useFirstRender to check whether it's the first render.  -  by @vikiboss (aee59)

  • useAsyncFn:

    • Rewrite to use auto-tracked state to improve performance  -  by @vikiboss (3ec25)
  • useClipboard:

  • useClipboardItems:

  • useLatest:

  • useLoadingSlowFn:

    • Rewrite to use auto-tracked state to improve performance  -  by @vikiboss (97226)
  • usePagination:

    • Support return sliced list directly (pass list in options), add indexStart, indexEnd in returns  -  by @vikiboss (2ed32)
  • usePerformanceObserver:

  • usePrevious:

  • useQuery:

  • useRequest:

    • Deprecated useRequest, please use useQuery instead.  -  by @vikiboss (26c51)
  • useWebObserver:

    • Support additional supported check for specific observer  -  by @vikiboss (d30a9)

   🐞 Bug Fixes

    View changes on GitHub

🚀 功能

🐞 修复

在 GitHub 上查看更改

v1.4.0

09 Aug 02:20
Compare
Choose a tag to compare

Add useRequest Hook

useRequest is a common hook for data fetching, supports cache, automatic refresh, and many awesome features.

  • Support basic async operations state management (loading, data, error, params, etc.)
  • Support many lifecycle hooks, such as onBefore, onSuccess, onError, etc.
  • Support continuous automatic refresh, manual refresh, and refresh control
  • Support automatic refresh when the network is reconnected, the page is focused, etc.
  • Support cross-platform visibility and online judgment to control automatic refresh
  • Support error retry, error retry interval, and error retry count
  • Support throttle and debounce for manual refresh
  • Support custom loading timeout, loading slow detection, and loading slow timeout
  • Support cache, cache expiration time, and cache provider (SWR)
  • Support clear cache, get cache, and mutate cache globally or locally
  • Support pausable to control internal automatic behavior
  • Support manual refresh, automatic refresh, and manual control refresh

   🚀 Features

  • New Hook useInputComposition to track composition state of input element  -  by @vikiboss (5be4b)
  • New Hook useLoadingSlowFn to track loading slow state  -  by @vikiboss (732fa)
  • New Hook useReConnect to run a callback when re-connect  -  by @vikiboss (772ab)
  • New Hook useReFocus to run a callback when re-focus  -  by @vikiboss (88cc9)
  • New Hook useRetryFn to create a function with retry mechanism  -  by @vikiboss (2eceb)
  • createSingleLoading:
    • Deprecated, it will be removed in the future, maybe moved to @shined/reactive  -  by @vikiboss (8b479)
  • useAsyncFn:
  • useReactive:
    • Deprecated, it will be removed in the future, maybe moved to @shined/reactive  -  by @vikiboss (03ac5)

   🐞 Bug Fixes

   🏎 Performance

  • useLoadingSlowFn: Using getter to refine performance  -  by @vikiboss (31a59)
    View changes on GitHub

添加 useRequest 钩子

useRequest 是一个常用的数据获取钩子,支持缓存、自动刷新以及许多其他优秀特性。

  • 支持基本异步操作状态管理(加载中、数据、错误、参数等)
  • 支持多种生命周期钩子,例如 onBefore、onSuccess、onError 等
  • 支持连续自动刷新、手动刷新和刷新控制
  • 支持网络重新连接、页面聚焦等时自动刷新
  • 支持跨平台可见性和在线判断来控制自动刷新
  • 支持错误重试、错误重试间隔和错误重试次数
  • 支持对手动刷新进行节流和防抖处理
  • 支持自定义加载超时、加载缓慢检测和加载缓慢超时
  • 支持缓存、缓存过期时间和缓存提供者(SWR)
  • 支持全局或局部地清除缓存、获取缓存和变更缓存
  • 支持暂停以控制内部自动行为
  • 支持手动刷新、自动刷新和手动控制刷新

   🚀 功能

  • 新钩子 useInputComposition 用于追踪 input 元素的组合状态  -  由 @vikiboss 提供 (5be4b)
  • 新钩子 useLoadingSlowFn 用于追踪加载缓慢状态  -  由 @vikiboss 提供 (732fa)
  • 新钩子 useReConnect 用于重新连接时运行回调函数  -  由 @vikiboss 提供 (772ab)
  • 新钩子 useReFocus 用于重新聚焦时运行回调函数  -  由 @vikiboss 提供 (88cc9)
  • 新钩子 useRetryFn 用于创建具有重试机制的函数  -  由 @vikiboss 提供 (2eceb)
  • createSingleLoading:
    • 不推荐使用,将来会被移除,可能移至 @shined/reactive  -  由 @vikiboss 提供 (8b479)
  • useAsyncFn:
  • useReactive:
    • 不推荐使用,将来会被移除,可能移至 @shined/reactive  -  由 @vikiboss 提供 (03ac5)

   🐞 修复

   🏎 性能优化

  • useLoadingSlowFn: 使用 getter 来细化性能  -  由 @vikiboss 提供 (31a59)
    在 GitHub 上查看更改

v1.3.0

15 Jul 06:33
Compare
Choose a tag to compare

   🚀 Features

    View changes on GitHub

v1.2.1

10 Jul 02:35
Compare
Choose a tag to compare

   🐞 Bug Fixes

    View changes on GitHub

v1.2.0

10 Jul 01:38
Compare
Choose a tag to compare

   🚀 Features

   🐞 Bug Fixes

  • useActiveElement: Use useLayoutMount to prevent layout jitter  -  by @vikiboss (f8e25)
  • useBreakpoints: Use useDeepCompareLayoutEffect to prevent layout jitter  -  by @vikiboss (5a588)
  • useCssVar: Use useLayoutMount to prevent layout jitter  -  by @vikiboss (7935a)
  • useFavicon: Use useLayoutMount to prevent layout jitter  -  by @vikiboss (d0c82)
  • useFocus: Use useLayoutMount to prevent layout jitter  -  by @vikiboss (f2950)
  • useMediaQuery: Use useDeepCompareLayoutEffect to prevent layout jitter  -  by @vikiboss (11f16)
  • useNetwork: Use useIsomorphicLayoutEffect to prevent layout jitter  -  by @vikiboss (04255)
  • useSupported: Use useIsomorphicLayoutEffect to prevent layout jitter  -  by @vikiboss (b5378)
  • useTextDirection: Use useLayoutMount to prevent layout jitter  -  by @vikiboss (fc474)
  • useUrlSearchParams: Use useLayoutMount to prevent layout jitter  -  by @vikiboss (584d1)
  • useWindowFocus: Use useLayoutMount to prevent layout jitter  -  by @vikiboss (273e9)
  • useWindowScroll: Use useLayoutMount to prevent layout jitter  -  by @vikiboss (d136b)
  • useWindowSize: Use useLayoutMount to prevent layout jitter  -  by @vikiboss (c1d0b)
    View changes on GitHub

v1.1.4

09 Jul 07:51
Compare
Choose a tag to compare

   🐞 Bug Fixes

    View changes on GitHub

v1.1.3

03 Jul 09:47
Compare
Choose a tag to compare

   🐞 Bug Fixes

  • useInfiniteScroll: Fix onScroll event not being triggered when target scroll  -  by @vikiboss (73a9c)
  • useParallax: Remove unused options.  -  by @vikiboss (10f6b)
  • useTargetElement: Advance the reffable value resolve time in target element  -  by @vikiboss (e3766)
  • useTitle: Correct unify type name  -  by @vikiboss (19338)
    View changes on GitHub

v1.1.2

02 Jul 06:45
Compare
Choose a tag to compare

   🐞 Bug Fixes

  • createSingleLoading, useReactive: Use create option to avoid import and ESM require error  -  by @vikiboss (2b854)
    View changes on GitHub