Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 945a561 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
Size Change: -149 B (-0.12%) Total Size: 127 kB 📦 View Changed
ℹ️ View Unchanged
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v1-base #614 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 76 76
Lines 2470 2446 -24
Branches 797 792 -5
=========================================
- Hits 2470 2446 -24 🚀 New features to boost your workflow:
|
Antoliny0919
left a comment
There was a problem hiding this comment.
Thanks for working on this @hyesungoh !
Looks good to me 👽
I also appreciate the clear explanation in the changeset about removing the logic that skipped the callback when the same value was passed again.
This seems like a potentially important behavior change, do you think mentioning it only in the changeset is enough?
| expect(result.current).not.toBe(throttled); | ||
| }); | ||
|
|
||
| it('drops a pending call and returns a new function when leading or trailing changes', () => { |
There was a problem hiding this comment.
Would it be worth testing the case where leading changes as well? 😄
I noticed the test title says "leading or trailing" but this test only changes trailing.
There was a problem hiding this comment.
the debounced one had the same gap the other way around (only leading). both now check each option with it.each in 776449e 👍
|
thanks for the review 🙏
i think it's enough for this PR. the changeset already says who's affected and what to do, and it goes into the 1.0.0 release notes as is. as you know, we're preparing a v0-to-v1 codemod (#543). a codemod can rename and reshape code but can't catch a runtime change like this one, so on top of it i could try making the upgrade agent-friendly, built on the changesets 🤔 |
Sounds good! I'm not very familiar with codemods, so I'm not sure I have much to add there. I'll take a closer look at the code and learn more when I get a chance to review it. I like the idea of using changesets to help agents guide users through the upgrade, though I don't have a clear picture of how that would work yet. My first thought was to mention this in the docs, but I'm also not sure whether it needs to be called out separately. I'd expect users who run into this during the migration to check the release notes, since the issue comes up as part of the upgrade. I was just a little worried that I might be assuming others would approach it the same way I would 😂 |
…railing changes separately
776449e to
945a561
Compare
Overview
Closes #537
useDebouncedCallbackanduseThrottledCallbackcould not replace the deprecateduseDebounceanduseThrottle, because they forwarded a single value and hidcancel, which the shared implementation already returns.{ callback, debounceMs | throttleMs, leading, trailing }and return the wrapped function withcancel, typed fromcallback.onChangeis renamed tocallback. The hooks no longer skip a call that repeats the last forwarded value, so the old name no longer fits, and the rename makes existing calls fail to compile instead of changing behavior silently.useImpressionRef, the only place in the repo that relied on it, soonImpressionStartstill fires once when an element leaves and returns before the end is reported. Two regression tests cover this; the existing tests passed without the skip.callback.flushandisPendingare not part of this PR. The return value is a function with methods, so they can be added later in a minor release without breaking calls.Checklist
yarn run fixto format and lint the code and docs?yarn run test:coverageto make sure there is no uncovered line?