Fix fulfilling deleted variants (#2090)
* Add optional chaining * Fix type * Fix a similar bug in the stock exceeded dialog * Add keys to fulfillment lines * Add undefined to return type
This commit is contained in:
parent
a54fc0396b
commit
3ac4ac4c1b
3 changed files with 5 additions and 4 deletions
|
@ -230,6 +230,7 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
|
||||||
getToFulfillOrderLines(order?.lines),
|
getToFulfillOrderLines(order?.lines),
|
||||||
(line: OrderFulfillLineFragment, lineIndex) => (
|
(line: OrderFulfillLineFragment, lineIndex) => (
|
||||||
<OrderFulfillLine
|
<OrderFulfillLine
|
||||||
|
key={line.id}
|
||||||
line={line}
|
line={line}
|
||||||
lineIndex={lineIndex}
|
lineIndex={lineIndex}
|
||||||
warehouseId={warehouse?.id}
|
warehouseId={warehouse?.id}
|
||||||
|
|
|
@ -38,7 +38,7 @@ const OrderFulfillStockExceededDialogLine: React.FC<OrderFulfillStockExceededDia
|
||||||
thumbnail={line?.thumbnail?.url}
|
thumbnail={line?.thumbnail?.url}
|
||||||
>
|
>
|
||||||
{line?.productName}
|
{line?.productName}
|
||||||
{"attributes" in line.variant && (
|
{line.variant && "attributes" in line.variant && (
|
||||||
<Typography color="textSecondary" variant="caption">
|
<Typography color="textSecondary" variant="caption">
|
||||||
{getAttributesCaption(line.variant?.attributes)}
|
{getAttributesCaption(line.variant?.attributes)}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
|
@ -372,10 +372,10 @@ export const transformFuflillmentLinesToStockInputFormsetData = (
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const getAttributesCaption = (
|
export const getAttributesCaption = (
|
||||||
attributes: OrderFulfillLineFragment["variant"]["attributes"],
|
attributes: OrderFulfillLineFragment["variant"]["attributes"] | undefined,
|
||||||
): string =>
|
): string | undefined =>
|
||||||
attributes
|
attributes
|
||||||
.map(attribute =>
|
?.map(attribute =>
|
||||||
attribute.values.map(attributeValue => attributeValue.name).join(", "),
|
attribute.values.map(attributeValue => attributeValue.name).join(", "),
|
||||||
)
|
)
|
||||||
.join(" / ");
|
.join(" / ");
|
||||||
|
|
Loading…
Reference in a new issue