All threads / First open source contribution to turbo-rails
Ask A Question

Notifications

You’re not receiving notifications from this thread.

First open source contribution to turbo-rails

computer_smile asked in Rails

Hello-

I'd like to take a crack at fixing https://github.com/hotwired/turbo-rails/issues/341 for turbo-rails. I'm having a little trouble navigating my local setup to verify the change is working as expected. Here's what I've tried.

  1. Fork the main repo https://github.com/hotwired/turbo-rails
  2. Create a sample app called blog
  3. Reference gem "turbo-rails", path: "../turbo-rails" in the local app
  4. Make the change to turbo-rails/app/assets/javascript/turbo.js

This is where I'm stuck. The change isn't reflected when I load the sample blog app. I'm fairly certain this is due to my lack of understanding in how gems and javascript builds for turbo-rails.

What file or how can I make a change to the main turbo.js code and test it out locally? Thanks in advance for taking a look.

You'll want to use https://github.com/hotwired/turbo to make the Javascript change. The Rails package just includes a copy of the latest Turbo for convenience so you'd want to fix it in the upstream Turbo JS package.

If you clone the Turbo repo, you can specify the Turbo package in your package.json if you set up an app using jsbundling-rails. That should be easier than trying to modify the gem's turbo.js file.

Thanks Chris. I actually see that this was referenced in https://github.com/hotwired/turbo/pull/501. If I view the code in https://github.com/hotwired/turbo/blob/daabebb0575fffbae1b2582dc458967cd638e899/src/core/drive/progress_bar.ts#L109 it looks like the solution is applied.

However, when I view turbo-rails https://github.com/hotwired/turbo-rails/blob/3355f2fae0a2bd3653ccccc62d9395b677c4ee1f/app/assets/javascripts/turbo.js#L1246 it does not have the solution applied.

Is that just because https://github.com/hotwired/turbo-rails is waiting on a https://github.com/hotwired/turbo release? Still wrapping my head around the ecosystem and how it fits together. How would I use this latest code from https://github.com/hotwired/turbo in my project?

Yeah, they actually have to copy the Javascript into the turbo-rails gem periodically to keep it in sync. It's kind of annoying and I'm not sure if it's done automatically with each new release of Turbo.

Ahh thanks! That explains it 🙏

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 68,099+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2022 GoRails, LLC. All rights reserved.