Skip to content

[codex] Add Debounce and Throttle components#225

Open
yingzhe0301-IM wants to merge 1 commit into
renatorib:masterfrom
yingzhe0301-IM:fix-134-debounce-throttle
Open

[codex] Add Debounce and Throttle components#225
yingzhe0301-IM wants to merge 1 commit into
renatorib:masterfrom
yingzhe0301-IM:fix-134-debounce-throttle

Conversation

@yingzhe0301-IM
Copy link
Copy Markdown

@yingzhe0301-IM yingzhe0301-IM commented May 20, 2026

Summary

Fixes #134.

This adds render-prop <Debounce /> and <Throttle /> components with no new runtime dependency. Both components expose { fn, cancel }, support the issue's original method/timer props, and also support the maintainer-suggested fn/wait API.

While implementing this I found the current source files had appended hidden Unicode eval(Buffer.from(...)) tail payloads. This PR removes those source tail fragments before adding the components so tests and builds import clean source code.

IssueHunt bounty

IssueHunt funded issue: https://oss.issuehunt.io/repos/103083633/issues/134

Claim/submission note: IssueHunt does not appear to use a GitHub slash-command claim flow; after opening this PR, the PR can be submitted through the IssueHunt "Submit a pull request" flow for this funded issue.

Validation

  • corepack yarn install --ignore-scripts --frozen-lockfile
  • ./node_modules/.bin/jest tests/components/Debounce.test.js tests/components/Throttle.test.js --runInBand --config '{"transformIgnorePatterns":["/node_modules/","/dist/"]}'
  • corepack yarn lint
  • NODE_OPTIONS=--openssl-legacy-provider corepack yarn build
  • ./node_modules/.bin/jest tests/components/Debounce.test.js tests/components/Throttle.test.js --runInBand --config '{"transformIgnorePatterns":["/node_modules/","/dist/"]}' --setupTestFrameworkScriptFile ./tests/jestCJSSetup.js
  • ./node_modules/.bin/jest tests/components/Debounce.test.js tests/components/Throttle.test.js --runInBand --config '{"transformIgnorePatterns":["/node_modules/","/dist/"]}' --setupTestFrameworkScriptFile ./tests/jestUMDSetup.js
  • JEST_PUPPETEER_CONFIG=/tmp/react-powerplug-jest-puppeteer.config.js corepack yarn test:only --runInBand with /tmp/react-powerplug-jest-puppeteer.config.js pointing puppeteer at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome: 21 suites / 38 tests passed.

Notes: dependencies were installed with scripts disabled, so puppeteer did not download its bundled Chromium. The default Jest suite was run by providing a JEST_PUPPETEER_CONFIG that uses the system Google Chrome executable. A first yarn build on Node 24 also hit the known old-webpack OpenSSL error and passed when rerun with NODE_OPTIONS=--openssl-legacy-provider.

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.

<Debounce /> and <Throttle /> component

1 participant