Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(useThrottleFn/useDebounceFn): support requestAnimationFrame #2332

Merged
merged 3 commits into from
Mar 28, 2024

Conversation

zhe-he
Copy link

@zhe-he zhe-he commented Sep 26, 2023

fix: #2331

@CLAassistant
Copy link

CLAassistant commented Sep 26, 2023

CLA assistant check
All committers have signed the CLA.

@liuyib liuyib changed the title feature: support requestAnimationFrame feat(useThrottleFn): support requestAnimationFrame Sep 26, 2023
@liuyib liuyib changed the title feat(useThrottleFn): support requestAnimationFrame fix(useThrottleFn): support requestAnimationFrame Sep 26, 2023
@liuyib
Copy link
Collaborator

liuyib commented Sep 26, 2023

Thank you for your contribution.

@@ -17,7 +17,8 @@ function useDebounceFn<T extends noop>(fn: T, options?: DebounceOptions) {

const fnRef = useLatest(fn);

const wait = options?.wait ?? 1000;
// https://github.com/alibaba/hooks/issues/2331
const wait = 'wait' in options ? options.wait : 1000;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to have "breaking changes", advise to do in v4

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

存在 breaking changes 的:

旧行为:

// 设置
{ wait: undefined }

// 被处理成
{ wait: 1000 }

新行为:

// 设置
{ wait: undefined }

// 被处理成
{ wait: undefined }

@crazylxr
Copy link
Collaborator

crazylxr commented Mar 13, 2024

这个当做 v4 的 feature, @zhe-he 把 pr 往 v4 上合呢。

@crazylxr crazylxr added the v4 label Mar 13, 2024
@liuyib liuyib changed the base branch from master to v4 March 13, 2024 14:55
@zhe-he
Copy link
Author

zhe-he commented Mar 14, 2024

刚看见这条通知,看见基础分支已被更新成v4了,好像不需要我做啥😊

@liuyib liuyib changed the title fix(useThrottleFn): support requestAnimationFrame feat(useThrottleFn): support requestAnimationFrame Mar 14, 2024
@liuyib liuyib changed the title feat(useThrottleFn): support requestAnimationFrame feat(useThrottleFn/useDebounceFn): support requestAnimationFrame Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants