diff --git a/app/components/concerns/op_turbo/streamable.rb b/app/components/concerns/op_turbo/streamable.rb index 4802b7e83e90..48b45ecf11aa 100644 --- a/app/components/concerns/op_turbo/streamable.rb +++ b/app/components/concerns/op_turbo/streamable.rb @@ -45,6 +45,8 @@ def render_as_turbo_stream(view_context:, action: :update) when :replace template = render_in(view_context) when :remove + @wrapper_only = true + render_in(view_context) template = nil else raise "Unsupported action #{action}" @@ -79,13 +81,19 @@ def component_wrapper(tag: "div", class: nil, data: nil, style: nil, &block) @component_wrapper_used = true if inner_html_only? capture(&block) + elsif wrapper_only? + content_tag(tag, id: wrapper_key, class:, data:, style:) else content_tag(tag, id: wrapper_key, class:, data:, style:, &block) end end def inner_html_only? - @inner_html_only == true + !!@inner_html_only + end + + def wrapper_only? + !!@wrapper_only end def wrapper_key