Download Latest Version v3.10.0 source code.zip (857.6 kB) Google Add to Preferred Sources
Home / v3.10.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2026-09-06 5.8 kB
v3.10.0 source code.tar.gz 2026-09-06 501.8 kB
v3.10.0 source code.zip 2026-09-06 857.6 kB
Totals: 3 Items   1.4 MB 1

ahooks 3.10.0

中文

新功能与增强

修复

升级注意

runAsync / refreshAsync 被取消或被新调用覆盖时,会以 CancelledError 拒绝,而不再一直保持 pending。直接调用这些异步 API 的代码应捕获异常,并用 isCancelledError 区分取消与业务错误;run / refresh 会内部处理取消。

English

Features and enhancements

  • Support synchronous cleanup functions in useAsyncEffect, with React managing cleanup on dependency changes and unmount. Returning cleanup from an async callback remains unsupported. #2958
  • Add getInitialValueInEffect to useLocalStorageState to defer storage reads until after mount and avoid SSR hydration mismatches. #2906
  • Allow useSetState without an initial state, returning Partial<T>. #2905
  • Support ProForm's transform in useAntdTable through validateFieldsReturnFormatValue.

Fixes

  • Settle cancelled or superseded useRequest asynchronous calls with CancelledError; export CancelledError and isCancelledError. #2951
  • Fix throttled runAsync calls and debounce leading behavior while ready=false. #2899, #2946
  • Fix default-parameter type inference and clear timers when request cache entries are deleted. #2907, #2909
  • Fix stale data captured during the initial loadMore in useInfiniteScroll. #2896
  • Fix modifier-key keyup matching with exactMatch in useKeyPress. #2944
  • Fix Pointer Events support in useLongPress. #2947
  • Fall back to legacy media query listeners in useTheme for older Safari versions. #2916
  • Fix explicit generic and ref target compatibility in useEventListener, and preserve non-nullable ref return types. #2903, #2956
  • Remove the deprecated intersection-observer dependency. #2904

Upgrade note

Cancelled or superseded runAsync / refreshAsync calls now reject with CancelledError instead of remaining pending. Catch errors when using these APIs directly and use isCancelledError to distinguish cancellation from service errors. run / refresh handle cancellation internally.

Full changelog: https://github.com/alibaba/hooks/compare/v3.9.7...v3.10.0

Source: README.md, updated 2026-09-06