# What changed in ahooks

> 36 changes in ahooks 3 from its official release notes, upgrade guides and advisories: 2 breaking, 5 new APIs and options. Each one cited. Sources checked 2026-10-28. HTML: https://unstale.sh/npm/ahooks/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## ahooks 3

### Breaking changes

- Removes the deprecated dependency. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)
- Cancelled or superseded calls now reject with `CancelledError` instead of remaining pending; callers should catch errors and use `isCancelledError` to distinguish cancellation from service errors. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)

### New APIs and options

- 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. (3.11.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.11.0)
- Exported for identifying cancellation rejections from `useRequest` asynchronous calls. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)
- Exported so callers can distinguish cancellation from service errors. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)
- Defers storage reads until after mount to avoid SSR hydration mismatches. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)
- Enables `useAntdTable` to support ProForm's `transform` through the form instance. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)

### Performance

- Prevents unnecessary re-renders when the storage state remains the same. (3.9.7) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.9.7)

### Behavior and default changes

- Supports synchronous cleanup functions, which React runs when dependencies change and on unmount; cleanup returned from an async callback remains unsupported. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)
- Can be used without an initial state; the returned state is typed as `Partial<T>`. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)
- Uses requestAnimationFrame to update scroll position. (3.9.7) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.9.7)
- Adds legacy key aliases for compatibility. (3.9.7) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.9.7)

### Fixes and other changes

- Preserves configured Cookie attributes, including path and domain, when removing Cookies. (3.11.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.11.0)
- Preserves 0, false, and empty strings while continuing to filter out null and undefined. (3.11.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.11.0)
- Infers resource types correctly for URLs with queries or fragments and preserves the original element URLs. (3.11.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.11.0)
- Infers resource types correctly for URLs with queries or fragments and preserves the original element URLs. (3.11.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.11.0)
- Preserves history during batched updates, navigation, and updates following a reset. (3.11.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.11.0)
- Prevents repeated automatic requests after an empty page and defers bottom checks until loading state updates complete. (3.11.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.11.0)
- Clears loadingMore when cancelling requests, allowing subsequent button and scroll loading while ignoring cancelled responses and callbacks. (3.11.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.11.0)
- Rechecks whether more data is needed when the scroll container or viewport changes size, without treating the initial resize notification as a resize. (3.11.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.11.0)
- Invokes the latest callback while preserving native arguments and receiver, without recreating the observer when the callback changes. (3.11.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.11.0)
- Preserves function-valued state instead of invoking the value as a state updater during initialization or reset. (3.11.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.11.0)
- Recomputes selection maps and flags when the key property or callback changes. (3.11.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.11.0)
- Avoids accessing browser storage during server rendering. (3.11.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.11.0)
- Fixes debounce leading behavior that could affect subsequent requests while `ready=false`. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)
- Fixes calls that did not work in throttled scenarios. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)
- Fixes compatibility between explicit generics and ref targets. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)
- Preserves non-nullable ref return types. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)
- Fixes stale data captured during the initial `loadMore` call. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)
- Fixes modifier-key `keyup` matching when exact matching is enabled. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)
- Fixes Pointer Events support. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)
- Fixes type inference for default parameters. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)
- Clears related timers when request cache entries are deleted. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)
- Falls back to legacy media query listeners for older Safari versions. (3.10.0) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.10.0)
- Fixes clear not taking effect when called inside the execution function. (3.9.7) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.9.7)
- Fixes runAsync not returning immediately when ready=false and there is no pending state. (3.9.7) — [release notes](https://github.com/alibaba/hooks/releases/tag/v3.9.7)
