Added support for @hotwired/turbo.#1374
Conversation
| if (context.ReactOnRails) { | ||
| return context.ReactOnRails.option('turbo') === true; | ||
| } | ||
| } |
There was a problem hiding this comment.
Is a configuration better than detection?
There was a problem hiding this comment.
No, I also would prefer a detection if possible. But as I noticed Turbo will be included only as module (for webpack(er)) in contrast to Turbolinks, which will inject itself to the global window.
So I don't know a way to inspect the global environment to detect if the Turbo module is used somewhere in the application.. if you have a hint for me, we can adjust that of course.
There was a problem hiding this comment.
Try require within a try block.
I can get you a cod snippet if needed.
There was a problem hiding this comment.
The problem with detection logic like that is that it would only detect if turbo is being bundled through webpacker even though turbo supports sprockets as well.
|
@pgruener Let me know if I should take over your PR or if you have an ETA. I'd like to ship it in the next release. |
|
@justin808 Thanks for your message. You can of course take over, as I didn't get time yet to go on with your suggestion (even if it should only take a few minutes). My best ETA would be around the coming weekend, but I'd really appreciate it to be shipped soon. |
|
@pgruener Say 👋 when you get to the Slack. Next weekend would be fine. I've got a ton of other pending tasks. I really appreciate the help! |
|
@pgruener Any update? |
|
@Judahmeek can you review also? |
|
@pgruener can you see if you can fix the CI issues? |
|
We need some short docs on this. Maybe we should update this page: https://github.com/shakacode/react_on_rails/blob/9ef6b326213480d0022db42710e5517cad0317bc/docs/rails/turbolinks.md ? or is turbo different enough that we should create a new doc page? |
This change is