Skip to content

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

@julienma

Description

@julienma

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions