Building a modal form with Turbo Stream GET requests and custom stream actions · Colby.so

Turbo 7.2 brought major changes to what you can accomplish with Turbo Streams. To demonstrate those changes, today we are going to build a Turbo Stream-powered modal form without a single Turbo Frame. We will also create our own custom Turbo Stream action that emits a custom event on the browser.The key technique we will use in this article is an update to the standard method of using Turbo to open and populate modals. Prior to Turbo 7.2, Turbo would not allow GET requests to respond directly with Turbo Streams. Smart folks devised a workaround to this limitation which involved using empty Turbo Frames to sneak in Turbo Stream actions. That workaround still works fine, but it is no longer necessary.
Building a modal form with Turbo Stream GET requests and custom stream actions · Colby.so #ruby #rubydeveloper #rubyonrails #turbo https://rubyonrails.ba/single/building-a-modal-form-with-turbo-stream-get-requests-and-custom-stream-actions-colby-so

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles