[codex] Add Debounce and Throttle components#225
Open
yingzhe0301-IM wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 originalmethod/timerprops, and also support the maintainer-suggestedfn/waitAPI.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 lintNODE_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.jsJEST_PUPPETEER_CONFIG=/tmp/react-powerplug-jest-puppeteer.config.js corepack yarn test:only --runInBandwith/tmp/react-powerplug-jest-puppeteer.config.jspointing 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_CONFIGthat uses the system Google Chrome executable. A firstyarn buildon Node 24 also hit the known old-webpack OpenSSL error and passed when rerun withNODE_OPTIONS=--openssl-legacy-provider.