redux-beacon
redux-beacon copied to clipboard
Add notes about ensure/debounceEvent not supporting async events
Checklist
Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.
- [ ] I have added tests that prove my fix is effective or that my feature works.
- [x] I have added all necessary documentation (if appropriate)
What was done
Add a note in the docs that we don't currently support async events, cf. https://github.com/rangle/redux-beacon/issues/286#issuecomment-423023024.
Associated Issues
- #286
:heart: Thanks
Thanks for taking the time to help out with the project, it's much appreciated :slightly_smiling_face:
Thanks so much for this!
The additions to the ensure
doc are perfect. But, debounceEvent
actually should work with async events. If possible, could you remove those changes and just leave the additions to the ensure
docs?
Oh, sure.
But, what you mean is that I should be able to do this?
const emitEvent1 = debounceEvent(60*1000, emitEvent1Validated);
const emitEvent1Validated = ensure(validator,
logEvent((action) => ({
type: 'My Event'
}))
);
I'm pretty sure I tried both debounceEvent(100, ensure(...))
and ensure(validator, debounceEvent(...))
, and couldn't make it work any way.
I'm waiting for your confirmation before rolling back https://github.com/rangle/redux-beacon/pull/288/commits/e3dbf6421f14c5685bed89ce40e58be2d3819e15.
Hmm...odd. That snippet should work. ensure
will always return a plain old synchronous event definition. And the debounceEvent
util should work with any plain old synchronous event definition as seen in the type definitions:
function debounceEvent(
msDelay: number,
eventDef: EventDefinition
): EventDefinition {
...
}