Skip to content

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

Rebase fixes

dominik-zeglene937233a0b96
diff --git a/saleor/static/dashboard-next/orders/views/OrderDetails/index.tsx b/saleor/static/dashboard-next/orders/views/OrderDetails/index.tsx
index e94ab77962..2382ca6d0a 100644
--- a/saleor/static/dashboard-next/orders/views/OrderDetails/index.tsx
+++ b/saleor/static/dashboard-next/orders/views/OrderDetails/index.tsx
@@ -398,12 +398,6 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({
variants={maybe(() =>
variantSearchOpts.data.products.edges
.map(edge => edge.node)
- .map(product => ({
- ...product,
- variants: product.variants.edges.map(
- edge => edge.node
- )
- }))
.map(product =>
product.variants.map(variant => ({
...variant,
@@ -603,12 +597,6 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({
variants={maybe(() =>
variantSearchOpts.data.products.edges
.map(edge => edge.node)
- .map(product => ({
- ...product,
- variants: product.variants.edges.map(
- edge => edge.node
- )
- }))
.map(product =>
product.variants.map(variant => ({
...variant,
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantNavigation/ProductVariantNavigation.tsx b/saleor/static/dashboard-next/products/components/ProductVariantNavigation/ProductVariantNavigation.tsx
index d97aa0ca45..99ea45c9d0 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantNavigation/ProductVariantNavigation.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantNavigation/ProductVariantNavigation.tsx
@@ -12,11 +12,14 @@ import Skeleton from "../../../components/Skeleton";
import TableCellAvatar from "../../../components/TableCellAvatar";
import i18n from "../../../i18n";
import { maybe, renderCollection } from "../../../misc";
+import { ProductVariantCreateData_product_variants } from "../../types/ProductVariantCreateData";
import { ProductVariantDetails_productVariant } from "../../types/ProductVariantDetails";
interface ProductVariantNavigationProps {
current?: string;
- variants: ProductVariantDetails_productVariant[];
+ variants:
+ | ProductVariantDetails_productVariant[]
+ | ProductVariantCreateData_product_variants[];
onRowClick: (variantId: string) => void;
}
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx b/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx
index 0553d1d860..bb348662dd 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx
@@ -106,13 +106,7 @@ const ProductVariantPage = decorate<ProductVariantPageProps>(
<div>
<ProductVariantNavigation
current={variant ? variant.id : undefined}
- variants={
- variant
- ? variant.product.variants.edges.map(
- edge => edge.node
- )
- : undefined
- }
+ variants={maybe(() => variant.product.variants)}
onRowClick={(variantId: string) => {
if (variant) {
return onVariantClick(variantId);
@@ -181,11 +175,9 @@ const ProductVariantPage = decorate<ProductVariantPageProps>(
onImageSelect={onImageSelect}
open={isImageSelectModalActive}
images={productImages}
- selectedImages={
- variant && variant.images && variant.images.edges
- ? variant.images.edges.map(edge => edge.node.id)
- : undefined
- }
+ selectedImages={maybe(() =>
+ variant.images.map(image => image.id)
+ )}
/>
</>
)}
diff --git a/saleor/static/dashboard-next/products/fixtures.ts b/saleor/static/dashboard-next/products/fixtures.ts
index ab9ef7b75a..ab1a685a91 100644
--- a/saleor/static/dashboard-next/products/fixtures.ts
+++ b/saleor/static/dashboard-next/products/fixtures.ts
@@ -2258,19 +2258,23 @@ export const variant = (placeholderImage: string): ProductVariant => ({
images: [
{
__typename: "ProductImage",
- id: "img1"
+ id: "img1",
+ url: placeholderImage
},
{
__typename: "ProductImage",
- id: "img2"
+ id: "img2",
+ url: placeholderImage
},
{
__typename: "ProductImage",
- id: "img7"
+ id: "img7",
+ url: placeholderImage
},
{
__typename: "ProductImage",
- id: "img8"
+ id: "img8",
+ url: placeholderImage
}
],
name: "Extended Hard",
diff --git a/saleor/static/dashboard-next/products/views/ProductImage/index.tsx b/saleor/static/dashboard-next/products/views/ProductImage/index.tsx
index 64668148df..e5f262d22b 100644
--- a/saleor/static/dashboard-next/products/views/ProductImage/index.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductImage/index.tsx
@@ -6,6 +6,7 @@ import ActionDialog from "../../../components/ActionDialog";
import Messages from "../../../components/messages";
import Navigator from "../../../components/Navigator";
import i18n from "../../../i18n";
+import { maybe } from "../../../misc";
import ProductImagePage from "../../components/ProductImagePage";
import {
TypedProductImageDeleteMutation,
@@ -81,16 +82,7 @@ export const ProductImage: React.StatelessComponent<ProductImageProps> = ({
<ProductImagePage
disabled={loading}
image={image || null}
- images={
- data &&
- data.product &&
- data.product.images &&
- data.product.images.edges
- ? data.product.images.edges.map(
- edge => edge.node
- )
- : undefined
- }
+ images={maybe(() => data.product.images)}
onBack={handleBack}
onDelete={() =>
navigate(