From 91f0a801897a8f8eaa6de7f787cbae258965995b Mon Sep 17 00:00:00 2001 From: David Cook Date: Wed, 17 Apr 2024 15:05:54 +1000 Subject: [PATCH] Use POST for action that creates data, duh. Turbo cleverly pre-fetches GET requests to save loading time. But that resulted in dozens of unwanted clones. Attack of the clones!!! I checked: even though this route predates the new products screen, it wasn't being used anywhere else. The old products screen uses the API instead. --- app/views/admin/products_v3/_product_row.html.haml | 2 +- config/routes/spree.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/products_v3/_product_row.html.haml b/app/views/admin/products_v3/_product_row.html.haml index 4a8b0c8ce3..f23d9b0afd 100644 --- a/app/views/admin/products_v3/_product_row.html.haml +++ b/app/views/admin/products_v3/_product_row.html.haml @@ -37,7 +37,7 @@ %td.align-right = render(VerticalEllipsisMenu::Component.new) do = link_to t('admin.products_page.actions.edit'), edit_admin_product_path(product) - = link_to t('admin.products_page.actions.clone'), clone_admin_product_path(product) + = link_to t('admin.products_page.actions.clone'), clone_admin_product_path(product), method: :post %a{ "data-controller": "modal-link", "data-action": "click->modal-link#setModalDataSetOnConfirm click->modal-link#open", "data-modal-link-target-value": "product-delete-modal", "class": "delete", "data-modal-link-modal-dataset-value": {'data-current-id': product.id}.to_json } diff --git a/config/routes/spree.rb b/config/routes/spree.rb index f59e4e7dca..d7c4aa6473 100644 --- a/config/routes/spree.rb +++ b/config/routes/spree.rb @@ -59,7 +59,7 @@ Spree::Core::Engine.routes.draw do resources :products, except: :index do member do - get :clone + post :clone get :group_buy_options get :seo end