Skip to content

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

Handle null errors

dominik-zeglen1838e9f2454b
diff --git a/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx b/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx
index ec343e7ef8..f1ebf17a2b 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx
@@ -188,26 +188,32 @@ const OrderOperations: React.StatelessComponent<OrderOperationsProps> = ({
{updateOrderLine =>
children({
errors: [
- ...maybe(
+ ...(maybe(
() =>
createFulfillment.data
.orderFulfillmentCreate
- .errors,
- []
- ),
- ...maybe(
+ .errors
+ )
+ ? createFulfillment.data
+ .orderFulfillmentCreate
+ .errors
+ : []),
+ ...(maybe(
() =>
paymentCapture.data
- .orderCapture
- .errors,
- []
- ),
- ...maybe(
+ .orderCapture.errors
+ )
+ ? paymentCapture.data
+ .orderCapture.errors
+ : []),
+ ...(maybe(
() =>
paymentRefund.data
- .orderRefund.errors,
- []
- ),
+ .orderRefund.errors
+ )
+ ? paymentRefund.data
+ .orderRefund.errors
+ : []),
...(maybe(
() =>
addNote.data
@@ -216,20 +222,25 @@ const OrderOperations: React.StatelessComponent<OrderOperationsProps> = ({
? addNote.data
.orderAddNote.errors
: []),
- ...maybe(
+ ...(maybe(
() =>
update.data
- .orderUpdate.errors,
- []
- ),
+ .orderUpdate.errors
+ )
+ ? update.data
+ .orderUpdate.errors
+ : []),
- ...maybe(
+ ...(maybe(
() =>
updateDraft.data
.draftOrderUpdate
- .errors,
- []
+ .errors
)
+ ? updateDraft.data
+ .draftOrderUpdate
+ .errors
+ : [])
],
orderAddNote: {
data: addNote.data,