Skip to content

Commit

Permalink
fix: Include line_items.item
Browse files Browse the repository at this point in the history
  • Loading branch information
acasazza committed Apr 11, 2022
1 parent ccef839 commit 27bc292
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/components/OrderContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const OrderContainer: FunctionComponent<OrderContainerProps> = (props) => {
}
}
return (): void => unsetOrderState(dispatch)
}, [config.accessToken, orderId, state.includeLoaded])
}, [config.accessToken, orderId, state.includeLoaded, state.include])
const orderValue = useMemo(() => {
return {
...state,
Expand Down
14 changes: 1 addition & 13 deletions src/components/ShipmentsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type ShipmentsContainerProps = {
const ShipmentsContainer: React.FunctionComponent<ShipmentsContainerProps> = (
props
) => {
const { children, ...p } = props
const { children } = props
const [state, dispatch] = useReducer(shipmentReducer, shipmentInitialState)
const { order, getOrder, include, addResourceToInclude, includeLoaded } =
useContext(OrderContext)
Expand All @@ -50,17 +50,6 @@ const ShipmentsContainer: React.FunctionComponent<ShipmentsContainerProps> = (
},
})
}
if (!include?.includes('line_items.item')) {
addResourceToInclude({
newResource: ['line_items.item'],
})
} else if (!includeLoaded?.['line_items.item']) {
addResourceToInclude({
newResourceLoaded: {
'line_items.item': true,
},
})
}
if (order && !isEmpty(config) && order.shipments) {
getShipments({ order, dispatch, config })
}
Expand Down Expand Up @@ -92,7 +81,6 @@ const ShipmentsContainer: React.FunctionComponent<ShipmentsContainerProps> = (
const hasStocks = order.line_items
.filter(({ item_type }) => item_type === 'skus')
.map((lineItem) => {
console.log('lineItem', lineItem)
// @ts-ignore
return !(lineItem.item?.inventory?.quantity >= lineItem?.quantity)
? false
Expand Down

0 comments on commit 27bc292

Please sign in to comment.