From 0b0de8c2164624404b5ba75fc01e6130bc1c8a65 Mon Sep 17 00:00:00 2001 From: Iago Espinoza Date: Thu, 31 Oct 2024 16:39:20 -0300 Subject: [PATCH] lint fix --- .../SKUSelector/components/SKUSelector.tsx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/react/components/SKUSelector/components/SKUSelector.tsx b/react/components/SKUSelector/components/SKUSelector.tsx index d99f9b4e9..c3619fa73 100644 --- a/react/components/SKUSelector/components/SKUSelector.tsx +++ b/react/components/SKUSelector/components/SKUSelector.tsx @@ -122,10 +122,9 @@ interface AvailableVariationParams { } export const orderItemsByAvailability = ( - item1: SelectorProductItem, + item1: SelectorProductItem, item2: SelectorProductItem ) => { - const isAvailableItem1 = isSkuAvailable(item1) const isAvailableItem2 = isSkuAvailable(item2) @@ -140,17 +139,15 @@ export const orderItemsByAvailability = ( const defaultSellerItem1 = getDefaultSeller(item1.sellers) const defaultSellerItem2 = getDefaultSeller(item2.sellers) - const availabilityItem1 = defaultSellerItem1 + const availabilityItem1 = defaultSellerItem1 ? defaultSellerItem1.commertialOffer.AvailableQuantity : 0 - const availabilityItem2 = defaultSellerItem2 + const availabilityItem2 = defaultSellerItem2 ? defaultSellerItem2.commertialOffer.AvailableQuantity : 0 return availabilityItem2 - availabilityItem1 - } - const parseOptionNameToDisplayOption = ({ selectedVariations, @@ -193,8 +190,8 @@ const parseOptionNameToDisplayOption = // This is a valid combination option const possibleItemsOrderedByAvailability = - possibleItems.length > 1 - ? possibleItems.sort(orderItemsByAvailability) + possibleItems.length > 1 + ? possibleItems.sort(orderItemsByAvailability) : possibleItems const [item] = possibleItemsOrderedByAvailability