-
Notifications
You must be signed in to change notification settings - Fork 64
debounce-handler can get delay via props #23
debounce-handler can get delay via props #23
Conversation
I fixed the lint and github seems to be lagging with the pushes to travis |
Hi. I'm actually not sure that I fully agree with this pattern... When enhanced component receives some special props to control the HOC it's wrapped with. Could you please provide a particular example when this is needed? 🤔 |
@@ -7,9 +7,11 @@ const debounceHandler = (handlerName, delay, leadingCall) => (Target) => { | |||
constructor (props, context) { | |||
super(props, context) | |||
|
|||
const delayValue = typeof delay === 'function' ? delay(props) : delay |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could do this in throttle as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. It also lacks the same changes as in #22 :) Do you mind to work on that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a common module since since they are so similar? That way you don't have to remember to update and fix both. This could be an inheritable common component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep it "duplicated" for a while. If at some point we have a 3rd one then yes, I agree :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10-4 , I am down with that rule of 3 is a good one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whats the command line paradigm to update jest snapshots with start
? I tried yarn start test throttle-handler --updateSnapshot
and yarn start test throttle-handler -u
with no success .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I never used it like this, I should probably propagate an argument.
yarn start testWatch
+ u
keypress when it comes to it.
|
Works well with redux |
Got it, thanks! Could you also update its readme? |
Yes sure, want me to do throttle as well? Are there other functions that could use this besides debounce and throttle ? |
Yes please, see my comment above 🙏
No, at least as far as I remember, any other values are functions already. |
Codecov Report
@@ Coverage Diff @@
## master #23 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 17 17
Lines 239 242 +3
=====================================
+ Hits 239 242 +3
Continue to review full report at Codecov.
|
Is it ready? |
Yeppers |
Published as Thanks! |
I thought this feature would be nice where the instance of the component could pass down the debounce delay.
:)