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 read property 'document' of null on browser-refresh #301

Open
phoet opened this issue Sep 21, 2018 · 4 comments
Open

Cannot read property 'document' of null on browser-refresh #301

phoet opened this issue Sep 21, 2018 · 4 comments

Comments

@phoet
Copy link

phoet commented Sep 21, 2018

Version info

  • intercom-rails version: 0.4.0
  • Rails version: 5.2.1 (with turbolinks)

Expected behavior

no exception is thrown

Actual behavior

an exception is thrown

Steps to reproduce

  1. navigate with turbolinks
  2. open intercom window and interact (ie search FAQ)
  3. navigate without turbolinks (ie refresh the page, use the URL bar)

Logs

VM56 frame.579b2cfd.js:1 Uncaught TypeError: Cannot read property 'document' of null
    at VM56 frame.579b2cfd.js:1
    at Array.some (<anonymous>)
    at Object.v [as messengerIsVisible] (VM56 frame.579b2cfd.js:1)
    at i (VM56 frame.579b2cfd.js:1)
    at a (VM56 frame.579b2cfd.js:1)
    at VM56 frame.579b2cfd.js:1
(anonymous) @ VM56 frame.579b2cfd.js:1
v @ VM56 frame.579b2cfd.js:1
i @ VM56 frame.579b2cfd.js:1
a @ VM56 frame.579b2cfd.js:1
(anonymous) @ VM56 frame.579b2cfd.js:1
VM56 frame.579b2cfd.js:1 Uncaught TypeError: Cannot read property 'document' of null
    at VM56 frame.579b2cfd.js:1
    at Array.some (<anonymous>)
    at Object.v [as messengerIsVisible] (VM56 frame.579b2cfd.js:1)
    at i (VM56 frame.579b2cfd.js:1)
    at a (VM56 frame.579b2cfd.js:1)
    at VM56 frame.579b2cfd.js:1
(anonymous) @ VM56 frame.579b2cfd.js:1
v @ VM56 frame.579b2cfd.js:1
i @ VM56 frame.579b2cfd.js:1
a @ VM56 frame.579b2cfd.js:1
(anonymous) @ VM56 frame.579b2cfd.js:1
VM56 frame.579b2cfd.js:1 Uncaught TypeError: Cannot read property 'document' of null
    at VM56 frame.579b2cfd.js:1
    at Array.some (<anonymous>)
    at Object.v [as messengerIsVisible] (VM56 frame.579b2cfd.js:1)
    at i (VM56 frame.579b2cfd.js:1)
    at a (VM56 frame.579b2cfd.js:1)
    at VM56 frame.579b2cfd.js:1
(anonymous) @ VM56 frame.579b2cfd.js:1
v @ VM56 frame.579b2cfd.js:1
i @ VM56 frame.579b2cfd.js:1
a @ VM56 frame.579b2cfd.js:1
(anonymous) @ VM56 frame.579b2cfd.js:1
VM56 frame.579b2cfd.js:1 Uncaught TypeError: Cannot read property 'document' of null
    at VM56 frame.579b2cfd.js:1
    at Array.some (<anonymous>)
    at Object.v [as messengerIsVisible] (VM56 frame.579b2cfd.js:1)
    at i (VM56 frame.579b2cfd.js:1)
    at a (VM56 frame.579b2cfd.js:1)
    at VM56 frame.579b2cfd.js:1
(anonymous) @ VM56 frame.579b2cfd.js:1
v @ VM56 frame.579b2cfd.js:1
i @ VM56 frame.579b2cfd.js:1
a @ VM56 frame.579b2cfd.js:1
(anonymous) @ VM56 frame.579b2cfd.js:1
VM56 frame.579b2cfd.js:1 Uncaught TypeError: Cannot read property 'document' of null
    at VM56 frame.579b2cfd.js:1
    at Array.some (<anonymous>)
    at Object.v [as messengerIsVisible] (VM56 frame.579b2cfd.js:1)
    at i (VM56 frame.579b2cfd.js:1)
    at a (VM56 frame.579b2cfd.js:1)
    at VM56 frame.579b2cfd.js:1
(anonymous) @ VM56 frame.579b2cfd.js:1
v @ VM56 frame.579b2cfd.js:1
i @ VM56 frame.579b2cfd.js:1
a @ VM56 frame.579b2cfd.js:1
(anonymous) @ VM56 frame.579b2cfd.js:1
VM56 frame.579b2cfd.js:1 Uncaught TypeError: Cannot read property 'document' of null
    at VM56 frame.579b2cfd.js:1
    at Array.some (<anonymous>)
    at Object.v [as messengerIsVisible] (VM56 frame.579b2cfd.js:1)
    at i (VM56 frame.579b2cfd.js:1)
    at a (VM56 frame.579b2cfd.js:1)
    at VM56 frame.579b2cfd.js:1
(anonymous) @ VM56 frame.579b2cfd.js:1
v @ VM56 frame.579b2cfd.js:1
i @ VM56 frame.579b2cfd.js:1
a @ VM56 frame.579b2cfd.js:1
(anonymous) @ VM56 frame.579b2cfd.js:1
@phoet
Copy link
Author

phoet commented Sep 21, 2018

the output of trackjs is a bit more helpful:

  return [".intercom-launcher-frame", "#intercom-container",
    ".intercom-messenger", ".intercom-notifications"
  ].some(function(e) {
    var t = window.parent.document.querySelector(e); // window.parent is null
    if (t) {
      var n = t.getBoundingClientRect();
      return n && n.width > 0 && n.height > 0
    }
  })

@phoet
Copy link
Author

phoet commented May 15, 2019

😿

@ghiculescu
Copy link

@phoet did you end up working around this or just ignoring it?

@phoet
Copy link
Author

phoet commented Jan 11, 2021

Neither, ignored the errors

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