Skip to content

Commit

Permalink
fix(dashboard): Prevent order details page from crashing on no region
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperkristensen committed Dec 4, 2024
1 parent 665eea8 commit 8d78f64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/purple-tips-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---

fix(dashboard): Prevent order details page from crashing on no region
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
import {
Badge,
Button,
clx,
Container,
Copy,
Heading,
Expand All @@ -32,9 +33,9 @@ import {
toast,
Tooltip,
usePrompt,
clx,
} from "@medusajs/ui"

import { AdminReservation } from "@medusajs/types/src/http"
import { AdminPaymentCollection } from "../../../../../../../../core/types/dist/http/payment/admin/entities"
import { ActionMenu } from "../../../../../components/common/action-menu"
import { ButtonMenu } from "../../../../../components/common/button-menu/button-menu"
Expand All @@ -56,7 +57,6 @@ import { getReturnableQuantity } from "../../../../../lib/rma"
import { CopyPaymentLink } from "../copy-payment-link/copy-payment-link"
import ReturnInfoPopover from "./return-info-popover"
import ShippingInfoPopover from "./shipping-info-popover"
import { AdminReservation } from "@medusajs/types/src/http"

type OrderSummarySectionProps = {
order: AdminOrder
Expand Down Expand Up @@ -341,7 +341,7 @@ const Header = ({
shouldDisableReturn ||
isOrderEditActive ||
(!!orderPreview?.order_change?.return_id &&
!!!orderPreview?.order_change?.exchange_id) ||
!orderPreview?.order_change?.exchange_id) ||
!!orderPreview?.order_change?.claim_id,
},
{
Expand All @@ -356,7 +356,7 @@ const Header = ({
shouldDisableReturn ||
isOrderEditActive ||
(!!orderPreview?.order_change?.return_id &&
!!!orderPreview?.order_change?.claim_id) ||
!orderPreview?.order_change?.claim_id) ||
!!orderPreview?.order_change?.exchange_id,
},
],
Expand Down Expand Up @@ -590,7 +590,7 @@ const CostBreakdown = ({
return taxCodeMap
}, [order])

const automaticTaxesOn = !!order.region!.automatic_taxes
const automaticTaxesOn = !!order.region?.automatic_taxes
const hasTaxLines = !!Object.keys(taxCodes).length

const discountTotal = automaticTaxesOn
Expand Down

0 comments on commit 8d78f64

Please sign in to comment.