Skip to content

RFC: Hotwire Turbo Frames Pattern

Jay Michalska edited this page Mar 24, 2025 · 2 revisions

What is this?

Approved by:

Reality?

As developers, in OBS we need to insert partials into views while they are already loaded. Sometimes this is used for the purpose of delaying rendering and sometimes it's used as a reaction to a users' action. For this purpose, we frequently use AJAX with supporting JS. This affects views, controllers and javascript.

For example:

Consequences?

It gets cumbersome, both in terms of maintaining a big library of code that essentially does the same thing, and in terms of writing new code. There is no one way to do it, and so the implementations that are there are generally messy and filled with various patches on top of the old code for the new things to work.

Future?

There needs to be one way to go about writing this kind of code. The simpler the better. If possible, we would be using a minimal amount of javascript that reacts to a button with an appropriate tag being pressed or a page element with appropriate page being made visible.

Proposal!

Replace all of this functionality with Turbo Frames. Turbo Frames allow us to render partials for pages using turbo-frame tag. It mimics functionality of the old html frame tags, by allowing you to navigate within the frame, including submitting forms and displaying the modified contents of the data after submission. It also allows you to break out of the frame to perform a full page navigation if required.

Clone this wiki locally