-
Notifications
You must be signed in to change notification settings - Fork 281
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 cart.get()
returning empty object for invalid ids
#2258
Conversation
Oxygen deployed a preview of your
Learn more about Hydrogen's GitHub integration. |
cartId, | ||
...cartInput, | ||
}, | ||
storefront.query<{cart: Cart | null}>(CART_QUERY(cartFragment), { |
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.
This doesn't need to specify the errors: StorefrontApiErrors
type?
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.
That type is added internally in storefront.query
as a union to whatever you pass here, so we don't need to specify it manually.
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.
Aside from that type question, this looks good
Closes #2242
@wizardlyhel would this be the right fix? If we change
formatAPIResult
it would affect many other methods in the cart, and I thinkcart.get
is the only nullable one, right?