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

support useDeepCompareEffectDebounce #2638

Open
ouzhou opened this issue Sep 4, 2024 · 7 comments
Open

support useDeepCompareEffectDebounce #2638

ouzhou opened this issue Sep 4, 2024 · 7 comments
Labels
feature New feature or request

Comments

@ouzhou
Copy link

ouzhou commented Sep 4, 2024

like
import { useDeepCompareEffectDebounce } from '@ant-design/pro-components';

@crazylxr
Copy link
Collaborator

你的场景是什么呢?

@crazylxr crazylxr added the needs more info Needs more information to continue label Sep 13, 2024
Copy link

Hi, ouzhou.

It seems that this issue is a bit vague and lacks some necessary information.

看起来这条 issue 描述得有些模糊,缺少一些必要的信息。

@ouzhou
Copy link
Author

ouzhou commented Sep 13, 2024

从名字上就能看出来,需要同时DeepCompare和Debounce
搜了一下发现pro-components自己单独实现了一个,感觉这里能不能多个hook组合使用

Copy link

Since the issue was labeled with needs more info, but no response in 3 days. This issue will be closed. If you have any questions, you can comment and reply.
由于该 issue 被标记为需要更多信息,却 3 天未收到回应。现关闭 issue,若有任何问题,可评论回复。

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 17, 2024
@crazylxr crazylxr removed the needs more info Needs more information to continue label Sep 22, 2024
@crazylxr crazylxr reopened this Sep 22, 2024
@crazylxr
Copy link
Collaborator

很多 hook 可能都需要防抖,这个正在考虑一种通用方法

@crazylxr crazylxr added the feature New feature or request label Sep 22, 2024
@ouzhou
Copy link
Author

ouzhou commented Sep 23, 2024

// createCombine函数,用于组合多个Hooks
function createCombine(...hooks) {
return function combinedHook(...args) {
const results = [];
for (const hook of hooks) {
results.push(hook(...args));
}
return results;
};
}

// 使用createCombine创建useDeepCompareEffectDebounce
const useDeepCompareEffectDebounce = createCombine(useDeepCompare, useDebounce);

@crazylxr
Copy link
Collaborator

// createCombine函数,用于组合多个Hooks function createCombine(...hooks) { return function combinedHook(...args) { const results = []; for (const hook of hooks) { results.push(hook(...args)); } return results; }; }

// 使用createCombine创建useDeepCompareEffectDebounce const useDeepCompareEffectDebounce = createCombine(useDeepCompare, useDebounce);

对,类似这种,欢迎来个 PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants