Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Simplify cache checking

dominik-zeglend5cc8840e1ee
diff --git a/saleor/static/dashboard-next/products/views/ProductImage.tsx b/saleor/static/dashboard-next/products/views/ProductImage.tsx
index bbd375f971..6d12e4c75b 100644
--- a/saleor/static/dashboard-next/products/views/ProductImage.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductImage.tsx
@@ -26,7 +26,7 @@ export const ProductImage: React.StatelessComponent<ProductImageProps> = ({
query={productImageQuery}
variables={{ imageId, productId }}
>
- {({ data }) => {
+ {({ data, loading }) => {
return (
<TypedProductImageDeleteMutation
mutation={productImageDeleteMutation}
@@ -35,32 +35,21 @@ export const ProductImage: React.StatelessComponent<ProductImageProps> = ({
{mutate => {
const handleDelete = () =>
mutate({ variables: { id: imageId } });
+ const image =
+ data &&
+ data.product &&
+ data.product.image &&
+ data.product.image.edges &&
+ data.product.image.edges[0] &&
+ data.product.image.edges[0]
+ ? data.product.image.edges[0].node
+ : undefined;
return (
<ProductImagePage
- description={
- data &&
- data.product &&
- data.product.image &&
- data.product.image.edges &&
- data.product.image.edges[0] &&
- data.product.image.edges[0].node &&
- data.product.image.edges[0].node.alt
- ? data.product.image.edges[0].node.alt
- : null
- }
+ description={image ? image.alt : null}
// TODO: unlock editing after API fixes
disabled={true}
- image={
- data &&
- data.product &&
- data.product.image &&
- data.product.image.edges &&
- data.product.image.edges[0] &&
- data.product.image.edges[0].node &&
- data.product.image.edges[0].node.url
- ? data.product.image.edges[0].node.url
- : null
- }
+ image={image ? image.url : null}
onBack={handleBack}
onDelete={handleDelete}
onSubmit={() => {}}