chore(react): internalize lodash.debounce (KNO-13811)#1022
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 29f99c5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
6a97082 to
29f99c5
Compare
c9a48f5 to
66bf33e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## kyle-kno-13812-internalize-jwt-decode-in-knocklabsclient-and-drop-the #1022 +/- ##
========================================================================================================
Coverage ? 63.64%
========================================================================================================
Files ? 210
Lines ? 10081
Branches ? 1303
========================================================================================================
Hits ? 6416
Misses ? 3640
Partials ? 25
|
|
Combined into #1024. |

Description
Internalizes
lodash.debouncein@knocklabs/reactand drops both thelodash.debounceruntime dependency and its@types/lodash.debouncedev dependency.The single call site (
useOnBottomScroll) usesdebounce(callback, 200)with default options (trailing-edge, noleading/maxWait) and never calls.cancel()/.flush(), so a minimal trailing-edge debounce matches current behavior exactly.What changed
packages/react/src/modules/core/debounce/— a dedicated folder containing the trailing-edgedebounceutil (with acancel()for good measure).useOnBottomScroll.ts, and updated its test to mock the newdebouncemodule.packages/react/test/core/debounce.test.tscovering the wait delay, single trailing invocation, call coalescing, latest-args behavior, andcancel().lodash.debounceand@types/lodash.debouncefrompackages/react/package.jsonand updated the lockfile.lodash.debounceremains in the lockfile only as a transitive dependency of a Babel helper — it is no longer a direct dependency of ours.Why: Part of the npm supply chain hardening effort.
@knocklabs/reactis published, so this also removes the dependency from consumers' install graphs.Linear: KNO-13811
Stack (bottom → top) — npm supply chain hardening:
clsxfrom@knocklabs/reactjwt-decodein@knocklabs/clientlodash.debouncein@knocklabs/react◀ this PRfast-deep-equalin@knocklabs/react-coreChecklist
test/core/debounce.test.ts) anduseOnBottomScroll.test.tsxpasses against the internalized debounce.