Skip to content

feat(core/hooks): add 'useThrottledCallback' hook#342

Merged
kimyouknow merged 4 commits intotoss:mainfrom
sukvvon:feat/use-throttled-callback
Mar 17, 2026
Merged

feat(core/hooks): add 'useThrottledCallback' hook#342
kimyouknow merged 4 commits intotoss:mainfrom
sukvvon:feat/use-throttled-callback

Conversation

@sukvvon
Copy link
Contributor

@sukvvon sukvvon commented Mar 9, 2026

Overview

Add useThrottledCallback hook as the throttle version of useDebouncedCallback.

Completes the useThrottle/useThrottledCallback pair, matching the existing useDebounce/useDebouncedCallback pattern.

Checklist

  • Did you write the test code?
  • Have you run yarn run fix to format and lint the code and docs?
  • Have you run yarn run test:coverage to make sure there is no uncovered line?
  • Did you write the JSDoc?

timeThreshold,
edges = ['leading', 'trailing'],
}: ThrottleOptions & {
onChange: (newValue: boolean) => void;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note: onChange is currently boolean-only, matching useDebouncedCallback's current API. PR #267 extends useDebouncedCallback to generic <T> — after that merges, a follow-up to make useThrottledCallback generic as well would be welcome.

Copy link
Collaborator

@kimyouknow kimyouknow left a comment

Choose a reason for hiding this comment

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

LGTM!

@kimyouknow kimyouknow merged commit b94ff72 into toss:main Mar 17, 2026
10 checks passed
@sukvvon
Copy link
Contributor Author

sukvvon commented Mar 17, 2026

@kimyouknow Hi! I noticed that the merge commit (b94ff72) for #342 has you as the Author instead of me. It looks like this PR was merged with a merge commit instead of squash merge. With a regular merge, the merge commit's Author is set to whoever clicked the "Merge" button. Other PRs like #339 were squash-merged, so the Author correctly reflects the PR author. Could this be re-done with squash merge, or is there a way to fix the Author?

@sukvvon sukvvon mentioned this pull request Mar 17, 2026
4 tasks
kimyouknow added a commit that referenced this pull request Mar 17, 2026
@kimyouknow
Copy link
Collaborator

Hi @sukvvon, just a heads-up: when I merged this PR, the merge commit was incorrectly attributed to me instead of you due to a non-squash merge. I've fixed this by squashing the commits and force-pushing to main — your authorship is now correctly reflected. Sorry for the confusion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants