Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use both ensure() and debounceEvent()? #286

Open
3 of 14 tasks
julienma opened this issue Sep 19, 2018 · 2 comments
Open
3 of 14 tasks

Cannot use both ensure() and debounceEvent()? #286

julienma opened this issue Sep 19, 2018 · 2 comments

Comments

@julienma
Copy link

This is a...

  • 🪲 Bug Report
  • 🚀 Feature Request
  • 📜 Documentation Request

Note: for support questions, please use stackoverflow with the redux-beacon tag. This repository's issues are reserved for feature requests and bug reports.

Which version of Redux Beacon are you using?

  • v2.0.3

Which target(s) are you using?

  • Google Analytics
  • Google Analytics (gtag)
  • React Native Google Analytics
  • Google Tag Manager
  • React Native Google Tag Manager
  • Amplitude
  • Segment
  • Other/Third Party: ...(please specify here)

(If this is a bug report, feel free to delete the 📜 and 🚀
sections. Likewise, if this is a documentation or feature request, feel free to
delete the 🪲 sections)

🪲 What are the steps to reproduce your issue?

const validator = event => {
  // validate event...
  return true;
}

const emitEvent1 = ensure(validator, emitEvent1Debounced);
const emitEvent1Debounced = debounceEvent(60*1000,
  logEvent((action) => ({
    type: 'My Event'
  }))
);

export default (action) => {
  switch (action.type) {
    case MY_ACTION:
      return [emitEvent1, emitEvent2];
    default:
      return [];
  }
}

Please note that when using only ensure() or debounceEvent(), it works as expected. This only happens when trying to use both on the same event.

🪲 What did you expect to happen?

Event would be debounced, then validated before being sent to target.
Or the other way around: validated first, then debounced.

🪲 What happened instead?

Error:

Uncaught TypeError: eventDef is not a function
    at ensure.js:4
    at debounce-event.js:11
    at wrapped (raven.js:351)

Can you help out?

  • 🌟 I am a legend and can get started on a pull request right away given the go-ahead.
  • ⭐ I am a superstar and would like to help out given some guidance.
  • 😞 I won't be able to help out on this one.
@ttmarek
Copy link
Contributor

ttmarek commented Sep 20, 2018

Hey @julienma.

I would peg this as both a bug and a feature request. The ensure event was never updated to handle asynchronous events when that was introduced to redux-beacon.

If you like I could write up some test cases that we'd need to pass in order for us to add support for them.

Also if you think it's worth adding a note in the docs that we don't currently support async events that would be very helpful.

@julienma
Copy link
Author

Hey @ttmarek, thanks for the answer.
I made some changes to my code logic, and don't need this anymore.

However yes, that'd probably be a good idea to add a note in the docs. I've opened #288 for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants