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

detectEvents() results in Turbolinks is not defined #743

Closed
1 of 4 tasks
swrobel opened this issue Jun 21, 2017 · 5 comments
Closed
1 of 4 tasks

detectEvents() results in Turbolinks is not defined #743

swrobel opened this issue Jun 21, 2017 · 5 comments
Labels

Comments

@swrobel
Copy link

swrobel commented Jun 21, 2017

Help us help you! Please choose one:

  • My app crashes with react-rails, so I've included the stack trace and the exact steps which make it crash.
  • My app doesn't crash, but I'm getting unexpected behavior. So, I've described the unexpected behavior and suggested a new behavior.
  • I'm trying to use react-rails with another library, but I'm having trouble. I've described my JavaScript management setup (eg, Sprockets, Webpack...), how I'm trying to use this other library, and why it's not working.
  • I have another issue to discuss.

I've tried this in a large react-rails app that I've been trying to upgrade to 2.0 as well as a fresh app, neither of which includes turbolinks. I was attempting to debug why ReactRailsUJS.mountComponents() doesn't seem to be running automatically, which is what led me to attempt to call ReactRailsUJS.detectEvents(). I do not see any errors in the console when my page loads, only after calling detectEvents().

> ReactRailsUJS.detectEvents()
detect.js?5263:12 Uncaught ReferenceError: Turbolinks is not defined
    at module.exports (eval at <anonymous> (application.js:3324), <anonymous>:12:5)
    at Object.detectEvents (eval at <anonymous> (application.js:3313), <anonymous>:114:5)
    at <anonymous>:1:15
@apuntovanini
Copy link

Same issue here, can it be used without Turbolinks? Our app extensively use react-router, that conflicts with Turbolinks, would go for disabling the latter, but breaks page loading. We're calling mountComponents() manually as well, but nothing happens
Thanks

@rmosolgo
Copy link
Member

It looks like this line is causing the error, right?

if (typeof Turbolinks.EVENTS !== "undefined") {

Maybe the file should be update to something like

if (typeof Turbolinks !== "undefined" && ...)

?

@apuntovanini
Copy link

Can we make a PR on this? @reactjs

@BookOfGreg
Copy link
Member

@rmosolgo Can you give me permission on NPM please?
Not sure what you need to grant me publish, but my account is: https://www.npmjs.com/~bookofgreg

I'll push this out as part of 2.3.1 I think.

Thanks.

@rmosolgo
Copy link
Member

rmosolgo commented Oct 9, 2017

Very cool :) I added you as a collaborator, I think that should do it! https://www.npmjs.com/package/react_ujs

@BookOfGreg BookOfGreg added the bug label Oct 10, 2017
BookOfGreg added a commit that referenced this issue Oct 10, 2017
BookOfGreg added a commit that referenced this issue Oct 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants