You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a component that includes both a standard template and a variant.
Load a page showing the component
Submit a form
In the receiving controller, set the variant, then respond using a turbo stream
Expected behavior
The variant version of the component should be shown
Actual behavior
The default template is rendered
Example repo
This repo includes the recommended HomeController. The root page has 2 buttons, "Request Turbo Drive response" and "Request Turbo Stream response". Both buttons submit a form HomeController#create and in both cases the action sets request.variant = :compact.
The difference, however, is that the Turbo Drive version returns the compact variant, while the Turbo Streams version returns the default template. The page also displays the value of request.variant as well as the name of the variant that was loaded.
First page load
Response from Turbo Drive
Response from Turbo Stream
System configuration
Rails version: 7.1.3.2
Ruby version: 3.2.2
Gem version: 3.11.0
The text was updated successfully, but these errors were encountered:
HashNotAdam
changed the title
Variants not working with turbo streams
Variants not working with Turbo Streams
May 14, 2024
HashNotAdam
changed the title
Variants not working with Turbo Streams
Variants not working with XHR Turbo Stream responses
May 14, 2024
Steps to reproduce
Expected behavior
The variant version of the component should be shown
Actual behavior
The default template is rendered
Example repo
This repo includes the recommended
HomeController
. The root page has 2 buttons, "Request Turbo Drive response" and "Request Turbo Stream response". Both buttons submit a formHomeController#create
and in both cases the action setsrequest.variant = :compact
.The difference, however, is that the Turbo Drive version returns the compact variant, while the Turbo Streams version returns the default template. The page also displays the value of
request.variant
as well as the name of the variant that was loaded.First page load
Response from Turbo Drive
Response from Turbo Stream
System configuration
Rails version: 7.1.3.2
Ruby version: 3.2.2
Gem version: 3.11.0
The text was updated successfully, but these errors were encountered: