Просмотр исходного кода

fix(dashboard): add optional chaining to shipping lines to prevent UI from crashing (#3930)

Bibiana Sebestianova 2 месяцев назад
Родитель
Сommit
5e5ef68dda

+ 1 - 1
packages/dashboard/src/app/routes/_authenticated/_orders/orders.tsx

@@ -85,7 +85,7 @@ function OrderListPage() {
                     header: () => <Trans>Shipping</Trans>,
                     cell: ({ row }) => {
                         const value = row.original.shippingLines;
-                        return <div>{value.map(line => line.shippingMethod.name).join(', ')}</div>;
+                        return <div>{value?.map(line => line.shippingMethod.name).join(', ')}</div>;
                     },
                 },
             }}

+ 1 - 1
packages/dashboard/src/lib/components/ui/tooltip.tsx

@@ -36,7 +36,7 @@ function TooltipContent({
                 data-slot="tooltip-content"
                 sideOffset={sideOffset}
                 className={cn(
-                    'bg-secondary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-w-sm rounded-md px-3 py-1.5 text-xs',
+                    'bg-secondary text-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-w-sm rounded-md px-3 py-1.5 text-xs',
                     className,
                 )}
                 {...props}