diff --git a/package.json b/package.json index 701c0535..f241324e 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,7 @@ ] }, "dependencies": { - "antd": "^4.23.5", - "react": "17.0.2" + "antd": "^4.23.6" }, "devDependencies": { "@testing-library/jest-dom": "^5.15.1", @@ -56,4 +55,4 @@ "workspaces": [ "packages/*" ] -} +} \ No newline at end of file diff --git a/packages/rc-use-hooks/LICENSE b/packages/rc-use-hooks/LICENSE index 80578f4b..07f689b3 100644 --- a/packages/rc-use-hooks/LICENSE +++ b/packages/rc-use-hooks/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 doly-dev +Copyright (c) 2022 llq0802 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/rc-use-hooks/src/index.ts b/packages/rc-use-hooks/src/index.ts index 692a7a9a..d5143b36 100644 --- a/packages/rc-use-hooks/src/index.ts +++ b/packages/rc-use-hooks/src/index.ts @@ -14,7 +14,7 @@ export { default as useResetState } from './useResetState'; export { default as useSafeState } from './useSafeState'; export { default as useSetState } from './useSetState'; export { default as useShow } from './useShow'; -export type { OnShowInstance } from './useShow'; +export type { UseShowInstance, UseShowInstanceRef, UseShowOptions } from './useShow'; export { default as useThrottleFn } from './useThrottleFn'; export { default as useUnmounted } from './useUnmounted'; export { default as useUpdated } from './useUpdated'; diff --git a/packages/rc-use-hooks/src/useConcurrentRequest/index.md b/packages/rc-use-hooks/src/useConcurrentRequest/index.md index b4ef310b..c532f6ad 100644 --- a/packages/rc-use-hooks/src/useConcurrentRequest/index.md +++ b/packages/rc-use-hooks/src/useConcurrentRequest/index.md @@ -10,7 +10,7 @@ nav: # useConcurrentRequest -并发请求函数 请求结果数组顺序同参数数组顺序一致 +并发请求函数,支持设置最大并发数, 请求结果数组顺序同参数数组顺序一致 ## 代码演示 diff --git a/packages/rc-use-hooks/src/useLockAsyncFn/demos/demo1.tsx b/packages/rc-use-hooks/src/useLockAsyncFn/demos/demo1.tsx index a9957cf2..1754a73b 100644 --- a/packages/rc-use-hooks/src/useLockAsyncFn/demos/demo1.tsx +++ b/packages/rc-use-hooks/src/useLockAsyncFn/demos/demo1.tsx @@ -17,7 +17,7 @@ function mockRequest() { export default () => { const [count, setCount] = useState(0); - const submit = useLockAsyncFn(async (params) => { + const { run, loading } = useLockAsyncFn(async (params) => { message.info(`开始请求${params}`); await mockRequest(); setCount((val) => val + 1); @@ -27,7 +27,7 @@ export default () => { return ( <>
请求次数: {count}
- + > ); }; diff --git a/packages/rc-use-hooks/src/useLockAsyncFn/index.md b/packages/rc-use-hooks/src/useLockAsyncFn/index.md index bb89dbf7..c5c18e02 100644 --- a/packages/rc-use-hooks/src/useLockAsyncFn/index.md +++ b/packages/rc-use-hooks/src/useLockAsyncFn/index.md @@ -10,7 +10,7 @@ nav: # useLockAsyncFn -用于给一个异步函数增加竞态锁,防止并发执行。 +用于给一个异步函数增加节流阀,防止并发执行。 ## 代码演示 diff --git a/packages/rc-use-hooks/src/useLockAsyncFn/index.ts b/packages/rc-use-hooks/src/useLockAsyncFn/index.ts index 8bf66743..0ec0dfba 100644 --- a/packages/rc-use-hooks/src/useLockAsyncFn/index.ts +++ b/packages/rc-use-hooks/src/useLockAsyncFn/index.ts @@ -1,4 +1,4 @@ -import { useCallback, useRef } from 'react'; +import { useCallback, useRef, useState } from 'react'; /** * 用于给一个异步函数节流阀,防止并发执行。 @@ -6,23 +6,31 @@ import { useCallback, useRef } from 'react'; export default function useLockAsyncFn(
fn: (...args: P) => Promise这是父组件