[#68876] Keep component size when refreshing via turbo stream

This commit is contained in:
Tobias Dillmann
2025-11-14 11:15:26 +01:00
parent caade44c4b
commit 8774d5dea2
2 changed files with 12 additions and 2 deletions
@@ -74,7 +74,7 @@ class Projects::StatusButtonComponent < ApplicationComponent
icon: status.icon,
item_id: status.id,
tag: :a,
href: project_status_path(project, status_code: status.value),
href: project_status_path(project, status_code: status.value, status_size: @size),
content_arguments: {
data: { turbo_method: status.value ? :put : :delete },
aria: { current: (true if status == @status) }
+11 -1
View File
@@ -63,7 +63,17 @@ class Projects::StatusController < ApplicationController
def respond_with_update_status_button
message = t(:notice_successful_update)
update_via_turbo_stream(component: Projects::StatusButtonComponent.new(project: @project, user: current_user))
# Some views send a size parameter to adjust the status button size, keep that in
# mind when refreshing the component via turbo stream:
size = params[:status_size]&.to_sym
component_options = {
project: @project,
user: current_user,
size:
}.compact
update_via_turbo_stream(component: Projects::StatusButtonComponent.new(**component_options))
render_success_flash_message_via_turbo_stream(message:)
respond_with_turbo_streams do |format|
fallback_responses_for(format, flash: { notice: message })