From 6aaddeaf4404851d032f8ea87c857c8af9070d4b Mon Sep 17 00:00:00 2001 From: jamey Date: Mon, 9 Mar 2026 16:25:00 +0000 Subject: [PATCH] fix settings editor crash on product pages The provider_label function was accessing product.provider_type but that field is on the provider_connection association, not the product itself. Handle the case where the association may not be preloaded. Co-Authored-By: Claude Opus 4.5 --- .../components/shop_components/settings_editor.ex | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/berrypod_web/components/shop_components/settings_editor.ex b/lib/berrypod_web/components/shop_components/settings_editor.ex index e8a7f01..6b67b2a 100644 --- a/lib/berrypod_web/components/shop_components/settings_editor.ex +++ b/lib/berrypod_web/components/shop_components/settings_editor.ex @@ -265,10 +265,17 @@ defmodule BerrypodWeb.ShopComponents.SettingsEditor do end defp provider_label(product) do - case product.provider_type do + # provider_type is on the association, not the product itself + provider_type = + case product do + %{provider_connection: %{provider_type: type}} when is_binary(type) -> type + _ -> nil + end + + case provider_type do "printify" -> "Printify" "printful" -> "Printful" - _ -> "Unknown" + _ -> "Print provider" end end