From bc58cbceb60fd0730c79e7a5134aec1bbab7bb68 Mon Sep 17 00:00:00 2001 From: sjfgzzwd9w-maker Date: Sun, 14 Jun 2026 21:39:33 -0700 Subject: [PATCH] fix: update wishlist item removal to include turbo stream response --- app/components/discover_rail/shop_wishlist_widget.html.erb | 2 +- app/controllers/shop/wishlists_controller.rb | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/components/discover_rail/shop_wishlist_widget.html.erb b/app/components/discover_rail/shop_wishlist_widget.html.erb index 507df244e..b36dcfd0b 100644 --- a/app/components/discover_rail/shop_wishlist_widget.html.erb +++ b/app/components/discover_rail/shop_wishlist_widget.html.erb @@ -4,7 +4,7 @@
<% wishlisted_items.each do |item| %> -
+
<%= button_to shop_wishlist_path(item.id), method: :delete, class: "shop-goals__remove", title: "Remove from wishlist" do %> × <% end %> diff --git a/app/controllers/shop/wishlists_controller.rb b/app/controllers/shop/wishlists_controller.rb index 910424244..c381ee2fe 100644 --- a/app/controllers/shop/wishlists_controller.rb +++ b/app/controllers/shop/wishlists_controller.rb @@ -10,6 +10,10 @@ def create def destroy authorize :shop current_user.shop_wishlists.where(shop_item_id: params[:id]).destroy_all - render json: { wishlisted: false } + + respond_to do |format| + format.json { render json: { wishlisted: false } } + format.turbo_stream { render turbo_stream: turbo_stream.remove("shop_wishlist_item_#{params[:id]}") } + end end end