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

Safely access window or wait until after calling .init #235

Closed
dcurletti opened this issue Jan 14, 2020 · 4 comments · Fixed by #273
Closed

Safely access window or wait until after calling .init #235

dcurletti opened this issue Jan 14, 2020 · 4 comments · Fixed by #273

Comments

@dcurletti
Copy link

dcurletti commented Jan 14, 2020

We would like to implement RUM in our server-side rendered React application. We get an error at runtime because this library attempts to access window during script load.

The ask is:

  • can we avoid invoking window until after calling init?
    OR
  • can we safely access window and do an early termination if its not defined?

We reverted to execute the code via html script download, but would really like to avoid that. Thanks!

@bcaudan
Copy link
Contributor

bcaudan commented Jan 15, 2020

Hi @dcurletti!

I have been able to reproduce your issue with a simple server side rendering setup.
We will see how to handle that and let you know when a fix is ready.

Thanks for the feedback!

@slavik-chapelskyi
Copy link

We experienced same issue using this package in next.js.

@slavik-chapelskyi
Copy link

@bcaudan Thanks 🎉

@bcaudan
Copy link
Contributor

bcaudan commented Feb 17, 2020

@dcurletti, @slavik-chapelskyi it should be fixed in v1.5.0.

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

Successfully merging a pull request may close this issue.

3 participants