Welcome! And thank you for verifying your Senior Dev Cred™ by invoking the important qualifier “it depends”. You’re right, there are many ways to look at this.
The hard-line progressive enhancement approach would be to always ensure that nothing is required besides HTML and HTTP(S) requests to access the app and use it effectively. That’s not always practical, but that’s the hard line approach. I don’t recommend you go all the way with this, because if you try to make a Rails app work without JavaScript, you’re building quite a lot of work for yourself. But do bear with me here.
This ethos brings along some tremendous benefits to you as the application designer, because it literally forces you to consider the relationships between actions and data changes, and can often expose you to some hard problems that you may be papering over using a higher-level approach (or even just old-school Ajax). It literally forces you to think in REST, which is not bad at all.
When you are first designing an app, I find it is often fastest to build out entire pages, however complex, as single templates, then start going through them with tweezers and pulling out individual features as partials (still just working with a single page render here, not moving into rendering those partials separately for a sub-page update).
Once you’ve done that, and ensured that everything still works, you can move on to making the appropriate additions of sub-page renders. Those can be nothing more than a modern equivalent of UJS, where a form request only updates the relevant parts of the page. (Think wrapping a form in a Turbo Frame.) But the same set of partials can also be used to make multiple changes to a page using Stimulus controllers or Turbo Streams.
And the beauty of this approach is that because you’ve decomposed the page at the template level, you can make any of those templates live in any context. If you want to use Action Cable to broadcast the changes to all users on the same page, that can literally be as simple as adding an after_save
callback in the model or an after_action
to the controller.
And if someone comes along with an older browser or a tin-foil hat, they won’t have a completely awful day.
Walter