You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Am I mistaken in thinking the dependency arrays are used incorrectly here. Won't client.product, variants, and productVariant always be different due to a lack of referential equality?
const checkAvailability = useCallback(
productId => {
client.product.fetch(productId).then(fetchedProduct => {
// this checks the currently selected variant for availability
const result = fetchedProduct.variants.filter(
variant => variant.id === productVariant.shopifyId
)
if (result.length > 0) {
setAvailable(result[0].available)
}
})
},
[client.product, productVariant.shopifyId, variants]
)
useEffect(() => {
checkAvailability(product.shopifyId)
}, [productVariant, checkAvailability, product.shopifyId])
The text was updated successfully, but these errors were encountered:
Am I mistaken in thinking the dependency arrays are used incorrectly here. Won't
client.product
,variants
, andproductVariant
always be different due to a lack of referential equality?The text was updated successfully, but these errors were encountered: