Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix: Correct `:remove` action for turbo stream response

Aaron Contreras158f180cd057
diff --git a/app/components/concerns/op_turbo/streamable.rb b/app/components/concerns/op_turbo/streamable.rb
index 4802b7e83e9..92216f134c7 100644
--- a/app/components/concerns/op_turbo/streamable.rb
+++ b/app/components/concerns/op_turbo/streamable.rb
@@ -45,6 +45,8 @@ module OpTurbo
when :replace
template = render_in(view_context)
when :remove
+ @wrapper_only = true
+ render_in(view_context)
template = nil
else
raise "Unsupported action #{action}"
@@ -79,6 +81,8 @@ module OpTurbo
@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
@@ -88,6 +92,10 @@ module OpTurbo
@inner_html_only == true
end
+ def wrapper_only?
+ !!@wrapper_only
+ end
+
def wrapper_key
if wrapper_uniq_by.nil?
self.class.wrapper_key