Replace the full container since we want to get back to the initial state

To see the boost button again
This commit is contained in:
Jorge Manrubia
2025-11-12 18:14:31 +01:00
parent 8795e64531
commit 2dab14ef64
3 changed files with 5 additions and 3 deletions
@@ -1 +1,3 @@
<%= turbo_stream.append([ @comment, :reactions ], partial: "cards/comments/reactions/reaction", locals: { reaction: @reaction }) %>
<%= turbo_stream.replace([ @comment, :reacting ]) do %>
<%= render "cards/comments/reactions/reactions", comment: @comment.reload %>
<% end %>
@@ -2,7 +2,7 @@
<%= form_with model: [ @comment.card, @comment, Reaction.new ],
class: "reaction reaction__form expanded",
html: { aria: { label: "New reaction" } },
data: { controller: "form reaction-emoji", turbo_frame: dom_id(@comment, :reacting), action: "keydown.esc->form#cancel submit->form#preventEmptySubmit turbo:submit-end->form#reset" } do |form| %>
data: { controller: "form reaction-emoji", turbo_frame: dom_id(@comment, :reacting), action: "keydown.esc->form#cancel submit->form#preventEmptySubmit" } do |form| %>
<label class="reaction__form-label flex gap" style="--column-gap: 0.4ch;">
<figure class="reaction__avatar margin-none flex-item-no-shrink">
<%= avatar_tag Current.user %>
@@ -10,7 +10,7 @@ class Cards::Comments::ReactionsControllerTest < ActionDispatch::IntegrationTest
test "create" do
assert_difference -> { @comment.reactions.count }, 1 do
post card_comment_reactions_path(@comment.card, @comment, format: :turbo_stream), params: { reaction: { content: "Great work!" } }
assert_turbo_stream action: :append, target: dom_id(@comment, :reactions)
assert_turbo_stream action: :replace, target: dom_id(@comment, :reacting)
end
end