Skip to content

Releases: alibaba/hooks

v2.4.0

02 Aug 07:00
Compare
Choose a tag to compare
  • useDrag add callbacks #543 #533
  • ✨ Add a reset method to useHistoryTravel #523 #517
  • 🐛 Fix the type definition of useSize #550 #546

v2.3.0

23 Jul 12:41
Compare
Choose a tag to compare
  • ✨ feat: add ueCookieState #462
  • 💄 chore: add table blocks for fusion table & chagne theme #544
  • 💄 doc: useDocumentVisibility visibilitychange event compatibility #506
  • 💄 perf: tsconfig enable strictNullChecks #505

v2.2.0

12 Jul 11:56
Compare
Choose a tag to compare
  • ✨ Feat: Add new hook useInterval #470
  • ✨ Feat: Add new hook useTitle #490
  • ✨ Feat: Add new hook useWhyDidYouUpdate #482
  • 🐛 Fix: Change build target to ES5 #426
  • 🐛 Fix: Remove importHelpers from tsconfig.json #486
  • 🐛 Fix: useVirtualList remove extra padding at bottom #469
  • 🐛 Fix: Change the behavior of useRequest notExecutedWarning from throw error to console.warn #499

v2.1.0

30 Jun 15:50
Compare
Choose a tag to compare
  • ✨ feat: useRequest add cacheTime and staleTime #459
  • ✨ feat: add useSetState #464
  • 🐛 fix: useMap is built to array #467
  • 📖 docs: update docs #447 #448

v2.0.1

22 Jun 02:09
Compare
Choose a tag to compare
  • 🐛 fix: useRequest persist function timer #444

v2.0.0

16 Jun 15:44
Compare
Choose a tag to compare

从 umi hooks 升级为 ahooks

升级概览

  • 新增了 3 个 Hooks
  • 删除了 Umi Hooks 中废弃的 6 个 Hooks
  • 制定了 API 规范,对 Hooks 进行了 API 升级
  • 所有的 DOM 类 Hooks 不再返回 ref
  • 部分 Hooks 不兼容升级

升级详情

新增

删除

删除的 6 个 Hooks 可以用 useRequest 代替

  • 删除了 useLoadMore
  • 删除了 useAntdTable
  • 删除了 useAPI
  • 删除了 useAsync
  • 删除了 usePagination
  • 删除了 useSearch

其它

  • useFormTable
    • 重命名为 useAntdTable
  • useRequest
    • 内置请求库从 umi-request 变成了 fetch 
    • 增加了 options.ready 配置,可以方便的实现依赖请求
    • 增加了 options.throwOnError 配置
    • Provider 从 UseAPIProvider 改名为 UseRequestProvider 
  • useDebounce
    • 基于 lodash.debounce 实现,支持更多参数
  • useDebounceFn
    • 基于 lodash.debounce 实现,支持更多参数
    • 删除了 deps 参数
  • useThrottle
    • 基于 lodash.throttle 实现,支持更多参数
  • useThrottleFn
    • 基于 lodash.throttle 实现,支持更多参数
    • 删除了 deps 参数
  • useBoolean
    • API 升级
  • useToggle
    • API 升级
  • useEventTarget
    • API 升级
  • useDocumentVisibility
    • 如果 document 不存在,返回值从 true 变为 undefined
  • useSize
    • API 升级,同时不再返回 ref
  • useScroll
    • API 升级,同时不再返回 ref 
  • useTextSelection
    • API 升级,同时不再返回 ref 
  • useInViewport
    • API 升级,同时不再返回 ref
  • useFullscreen
    • API 升级,同时不再返回 ref 
  • useEventListener
    • API 升级,同时不再返回 ref
  • useClickAway
    • API 升级,同时不再返回 ref 
  • useHover
    • API 升级,同时不再返回 ref 
  • useKeyPress
    • API 升级,同时不再返回 ref 

Upgraded from umi hooks to ahooks

Upgrade overview

  • Added 3 Hooks
  • 6 abandoned Hooks in Umi Hooks were deleted
  • Formulated API specification, upgraded the Hooks API
  • All DOM class Hooks no longer return ref
  • Some Hooks are incompatible with upgrades

Upgrade details

Add

Delete

The deleted 6 Hooks can be replaced by useRequest

  • Deleted useLoadMore
  • Deleted useAntdTable
  • Deleted useAPI
  • Deleted useAsync
  • Deleted usePagination
  • Deleted useSearch

Other

  • useFormTable
    • Rename to useAntdTable
  • useRequest
    • Built-in request Library from umi-request Became fetch
    • Added options.ready Configuration, can easily implement dependency requests
    • Added options.throwOnError Configuration, can easily implement dependency requests
    • Change the Provider name from UseAPIProvider to UseRequestProvider
  • useDebounce
    • Based on lodash.debounce Implementation, support more parameters
  • useDebounceFn
    • Based on lodash.debounce Implementation, support more parameters
    • Deleted deps Parameter
  • useThrottle
    • Based on lodash.throttle Implementation, support more parameters
  • useThrottleFn
    • Based on lodash.throttle Implementation, support more parameters
    • Deleted deps Parameter
  • useBoolean
    • API upgrade
  • useToggle
    • API upgrade
  • useEventTarget
    • API upgrade
  • useDocumentVisibility
    • If the document does not exist, the return value is from true Into undefined
  • useSize
    • API upgrade, and no longer return ref
  • useScroll
    • API upgrade, and no longer return ref
  • useTextSelection
    • API upgrade, and no longer return ref
  • useInViewport
    • API upgrade, and no longer return ref
  • useFullscreen
    • API upgrade, and no longer return ref
  • useEventListener
    • API upgrade, and no longer return ref
  • useClickAway
    • API upgrade, and no longer return ref
  • useHover
    • API upgrade, and no longer return ref 
  • useKeyPress
    • API upgrade, and no longer return ref

v1.9.3

31 May 10:23
8e01250
Compare
Choose a tag to compare
  • 🐛 fix: useToggle toggle function change to persist #403
  • 🐛 fix: improve type inference of useSessionStorageState and useLocalStorageState #381
  • 🐛 fix: useClickAway event type #371

v1.9.2

20 Apr 14:34
Compare
Choose a tag to compare
  • 🐛fix: useFormTable defaultType set to optional #363

v1.9.1

15 Apr 01:49
Compare
Choose a tag to compare
  • 🐛fix: useAntdTable reload error #346
  • 🐛fix: iOS webview bounce triggers loadMore function #353
  • 💄feat: useFormTable support defaultParams and defaultType #348

v1.9.0

05 Apr 12:06
Compare
Choose a tag to compare
  • ✨add useHistoryTravel #313
  • ✨add useTextSelection #312
  • ✨add useDocumentVisibility #304
  • 🐛fix: useRequest pagination mode support defaultParams #333
  • 🐛fix: useFormTable support form is null #332