npm / ahooks
ahooks
What changed in ahooks 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-28.
2 breaking5 new APIs and options1 performance4 behavior and defaults24 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initahooks 336 changes
Breaking changes 2
Removes the deprecated dependency.
Cancelled or superseded calls now reject with
CancelledErrorinstead of remaining pending; callers should catch errors and useisCancelledErrorto distinguish cancellation from service errors.
New APIs and options 5
The third argument accepts an options object with enabled to control whether outside-click listeners are attached; existing event-name string and array arguments remain supported.
Exported for identifying cancellation rejections from
useRequestasynchronous calls.Exported so callers can distinguish cancellation from service errors.
Defers storage reads until after mount to avoid SSR hydration mismatches.
Enables
useAntdTableto support ProForm'stransformthrough the form instance.
Performance 1
Prevents unnecessary re-renders when the storage state remains the same.
Behavior and default changes 4
Supports synchronous cleanup functions, which React runs when dependencies change and on unmount; cleanup returned from an async callback remains unsupported.
Can be used without an initial state; the returned state is typed as
Partial<T>.Uses requestAnimationFrame to update scroll position.
Adds legacy key aliases for compatibility.
Fixes and other changes 24
Preserves configured Cookie attributes, including path and domain, when removing Cookies.
Preserves 0, false, and empty strings while continuing to filter out null and undefined.
Infers resource types correctly for URLs with queries or fragments and preserves the original element URLs.
Infers resource types correctly for URLs with queries or fragments and preserves the original element URLs.
Preserves history during batched updates, navigation, and updates following a reset.
Prevents repeated automatic requests after an empty page and defers bottom checks until loading state updates complete.
Clears loadingMore when cancelling requests, allowing subsequent button and scroll loading while ignoring cancelled responses and callbacks.
Rechecks whether more data is needed when the scroll container or viewport changes size, without treating the initial resize notification as a resize.
Invokes the latest callback while preserving native arguments and receiver, without recreating the observer when the callback changes.
Preserves function-valued state instead of invoking the value as a state updater during initialization or reset.
Recomputes selection maps and flags when the key property or callback changes.
Avoids accessing browser storage during server rendering.
Fixes debounce leading behavior that could affect subsequent requests while
ready=false.Fixes calls that did not work in throttled scenarios.
Fixes compatibility between explicit generics and ref targets.
Preserves non-nullable ref return types.
Fixes stale data captured during the initial
loadMorecall.Fixes modifier-key
keyupmatching when exact matching is enabled.Fixes Pointer Events support.
Fixes type inference for default parameters.
Clears related timers when request cache entries are deleted.
Falls back to legacy media query listeners for older Safari versions.
Fixes clear not taking effect when called inside the execution function.
Fixes runAsync not returning immediately when ready=false and there is no pending state.