fix settings editor crash on product pages
All checks were successful
deploy / deploy (push) Successful in 1m33s
All checks were successful
deploy / deploy (push) Successful in 1m33s
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 <noreply@anthropic.com>
This commit is contained in:
parent
f7891188e0
commit
6aaddeaf44
@ -265,10 +265,17 @@ defmodule BerrypodWeb.ShopComponents.SettingsEditor do
|
|||||||
end
|
end
|
||||||
|
|
||||||
defp provider_label(product) do
|
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"
|
"printify" -> "Printify"
|
||||||
"printful" -> "Printful"
|
"printful" -> "Printful"
|
||||||
_ -> "Unknown"
|
_ -> "Print provider"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user