dharness / react-chat-window

Intercom-style live chat window written in react
The Unlicense
671 stars 250 forks source link

event listener & unmount #116

Closed tylerehc closed 5 years ago

tylerehc commented 5 years ago

I receive the following error:

Uncaught TypeError: Failed to execute 'removeEventListener' on 'EventTarget': 2 arguments required, but only 1 present.

I believe it has something to do with this section of code in /es/components/popups/PopupWindow.js

PopupWindow.prototype.componentWillUnmount = function componentWillUnmount() { this.scLauncher.removeEventListener(this.interceptLauncherClick); };

PopupWindow.prototype.render = function render() { var _this2 = this;

var _props = this.props,
isOpen = _props.isOpen,
children = _props.children;

return React.createElement(
  'div',
  { className: 'sc-popup-window', ref: function ref(e) {
      return _this2.emojiPopup = e;
    } },
  React.createElement(
    'div',
    { className: 'sc-popup-window--cointainer ' + (isOpen ? '' : 'closed') },
    React.createElement('input', {
      onChange: this.props.onInputChange,
      className: 'sc-popup-window--search',
      placeholder: 'Search emoji...'
    }),
    children
  )
);

};

tylerehc commented 5 years ago

I don't know why, but the git editor keeps ignoring my markup... sorry about the formatting...

I receive this error when I click to a page that doesn't have the chat widget running

tylerehc commented 5 years ago

i ended up putting it on every page of my app to get rid of the error, but it'd be great if you could select which pages it's on

heatherbooker commented 5 years ago

@dharness Can you release latest master to npm? I think that may help.

@tylerehc Sorry and thanks for the report! I'll get back to you more later.

tylerehc commented 5 years ago

Thanks Heather! I hope this is helpful in some way :) I'm content to have it run on all pages for now, and I love the component!!!

dharness commented 5 years ago

@tylerehc 1.2.0 was just released, let us know if that doesn't solve your problem @heatherbooker thanks for staying on top of this!

tylerehc commented 5 years ago

hey @dharness thanks for the update! I circled back to a situation where I was having this error, and after reinstalling the library, the error no longer occurs! Thank you for maintaining this fun and useful library.