-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(api): Prevent throw error, when skus is empty #1220
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 274f879:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it simulating the error and I think it's not working as expected since we won't have the missing SKUs on the error message.
"message": "Search API did not return the following skus: ",
Logs from the main local variables:
So I have a suggestion:
- Maps the
skus
object as a key/value object.
const skus = skuIds.map((skuId) => ({
key: skuId,
value: skuBySkuId[skuId],
}))
- The
missingSkus
mapping the new key (sku).
const missingSkus = skus.filter((sku) => !sku.value).map((sku) => sku.key)
- Keeps the original
if
and return theskus
values:
if (missingSkus.length > 0) {
//...
}
return skus.map((sku) => sku.value)
error message:
"message": "Search API did not return the following skus: 1010",
We can pair programming to discuss more :)
@eduardoformiga do you still think this change is necessary since now we're not using the checkout simulation? |
I think we are using the |
What's the purpose of this pull request?
Prevent throw error when SKUs is empty, also missingSkus will be empty.
How it works?
How to test it?
base.store
Deploy PreviewReferences