alexmingoia / purescript-pux

Build type-safe web apps with PureScript.
https://www.purescript-pux.org
Other
565 stars 76 forks source link

possible bug in Pux/Renderer/React.js #122

Closed gabysbrain closed 7 years ago

gabysbrain commented 7 years ago

I have a custom react class that creates its own events. I can get pux to recognize these events but each event triggers twice, once with the proper data (which is just an array not an event) and once with undefined. It seems that the problem is the function below which will call the event handler twice if ev.nativeEvent is undefined. Is this intentional?

exports.reactHandler = function (input) {
  return function (handler) {
    return function (ev) {
      if (ev.nativeEvent === undefined) {
        input(handler(ev))();
      }
      input(handler(ev.nativeEvent))();
    };
  };
};