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

Fail to catch errors on unmount #34

Closed
lawlmart opened this issue Jun 30, 2017 · 3 comments
Closed

Fail to catch errors on unmount #34

lawlmart opened this issue Jun 30, 2017 · 3 comments

Comments

@lawlmart
Copy link

If Intercom isn't loaded by the time the component unmounts an uncaught error is thrown.

index.js:106 Uncaught TypeError: window.Intercom is not a function
at Intercom.componentWillUnmount (index.js:106)
at ReactCompositeComponent.js:409
at measureLifeCyclePerf (ReactCompositeComponent.js:75)
at ReactCompositeComponentWrapper.unmountComponent (ReactCompositeComponent.js:408)

@zchsh
Copy link

zchsh commented Oct 4, 2017

Also running into this problem - have routes split into authorized and unauthorized routes, with Intercom on the authorized route only, and when navigating from authorized to unauthorized and then back again this error always shows up.

A bit new to React etc, but it would it make sense to do something like

componentWillUnmount() {
    if (!canUseDOM) return false;
    if (!window.Intercom) return false;

    window.Intercom('shutdown');

    delete window.Intercom;
  }

@mwickett
Copy link

mwickett commented Oct 5, 2017

It looks like #36 fixes this issue - any chance you can merge @nhagen? Thanks!

@nhagen
Copy link
Owner

nhagen commented Sep 1, 2019

I rewrote this package today and may have resolved this issue. See more details at #73 . Closing for now, but happy to re-open if this is still an issue.

@nhagen nhagen closed this as completed Sep 1, 2019
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

4 participants