Using Hotwire with Ruby on Rails
I’ve been pretty quiet recently - that’s because I’ve been having way too much fun playing with Hotwire.
In addition, you can specify areas of the page to be loaded on demand - so your initial page load can be really fast and the other stuff deferred till when it’s needed (for example, I’ve done a menu that only loads when you click the drop-down icon - and then it can check your permissions in real time to make sure you only have access to the correct options).
Finally it includes a layer over web-sockets so as stuff changes on the server, you can broadcast those changes to your client - as HTML fragments. It uses the same swapping technique as before to update your page without a full refresh - so you get live updates in two lines of code.
The advantage of not using a front-end framework for this kind of stuff (apart from being able to stick with the technology you’re already familiar with) is that you don’t need to replicate your logic. You’ve already written your models and business rules on the server - so why duplicate those rules and structures on the client as well?
If you want to see it in action, I’ve done a quick video and, I’m so impressed, I’m going to be doing more in-depth stuff on it as the next few weeks progress.