![]() This kind of upgrade work is something it's so easy to put off for existing applications. Stimulus is also due for a 2.1 release in the near future, which will include a helpful debug mode, previous value passing on the ValueChanged callbacks, default values, and a few other overdue enhancements. We're up to beta 7 now, and will keep going on the beta process for a bit longer while clearing out the backlog of pull requests and issues, but then it'll soon be time for a proper 7.0 final release as well. I released a couple of new versions of Turbo/Turbo Rails, which both fixed a number of bugs, but also gave us some great new powers, like before/after actions, built-in method links, and deduping of existing elements on the append/prepend actions. There was enough steps in that process to warrant documenting them in the turbo-rails repository.Īs part of this work, I caught up with both the Turbo and Stimulus repositories. That was something the old turbolinks-rails gem included in the box, but turbo-rails does not (since it's not needed for greenfield work). Turbo Drive is a direct continuation of Turbolinks, but it still required a fair bit of work to update all the namespaced events, and ensure that the Ajax requests coming from Rails UJS would play nice with 302 redirects. The meat of the coexistence work was in replacing Turbolinks with Turbo. Although it was easy enough, I still managed to wrongly turn a few of these conversions into duplicate data-target attributes. The upgrade to Stimulus 2.0 (from 1.1) took a little more effort, but solely because we wanted to upgrade early to the new target format of data-target="" instead of data-target="." (to get rid of the deprecation warnings). Something you don't need to do if you're starting with Turbo from the beginning, like we did with HEY, but it's a small price to pay for coexistence. It also required that all these new forms and method links we want flowing through Turbo instead of Rails UJS be tagged with that data-turbo=true attribute. And if you are still using rails/jquery-ujs (like Basecamp!), there's a new version 1.2.3 with the updated selectors as well. ![]() Making this so required an upgrade to the UJS event handler selectors, which will be part of the next Rails release. In our new setup, Rails UJS is still there to handle data-remote/data-method forms and links for the legacy code, but it leaves alone any link or form tagged with data-turbo=true. Yay!īasecamp 3 was originally built with Rails UJS, Turbolinks, and Stimulus. While existing JavaScript code stays as it is, we're now set for all our future development to use Turbo Frames, Turbo Streams, and Stimulus 2.0. It's not like we rewrote all the JavaScript we have to make this happen. Although upgrading is perhaps a big word. Hotwire is now powering Basecamp 3 on the alpha version we're running internally, and I thought it'd be helpful to document the upgrade process.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |