-
Notifications
You must be signed in to change notification settings - Fork 143
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
Implement shopper products #681
Conversation
packages/test-commerce-sdk-react/app/pages/use-shopper-product.tsx
Outdated
Show resolved
Hide resolved
If you're curious why the CI tests are failing, it's because we need to import I saw it in my branch, and I fixed it by reusing the jest setup file from
Hopefully I can merge my PR soon, so you can pull it into your branch. |
packages/commerce-sdk-react/src/hooks/ShopperProducts/query.test.tsx
Outdated
Show resolved
Hide resolved
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.
Other than this 1 comment, the whole PR looks good to me. Feel free to ask for someone else's feedback too, in case I overlook something.
packages/commerce-sdk-react/src/hooks/ShopperProducts/query.test.tsx
Outdated
Show resolved
Hide resolved
packages/commerce-sdk-react/src/hooks/ShopperProducts/query.test.tsx
Outdated
Show resolved
Hide resolved
packages/commerce-sdk-react/src/hooks/ShopperProducts/query.test.tsx
Outdated
Show resolved
Hide resolved
packages/commerce-sdk-react/src/hooks/ShopperProducts/query.test.tsx
Outdated
Show resolved
Hide resolved
if (!arg.ids) { | ||
throw new Error('ids is required for useProducts') | ||
} |
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.
what happens if you don't add this if statement?
Will commerce-sdk-isomorphic throw a similar error? Should we use that error? Because ultimately the schema is coming from the commerce-sdk-isomorphic parameters
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.
If we don't catch the error here, it will hit the network and returns an error, since we are using react-query
, by default it will retry 3 times before returning the error. I'd it is best if we can catch the error here before it hits the network. Here is what looks like if we don't catch that ids first
/* Interop Constraints */ | ||
"isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */, | ||
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ | ||
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */, |
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 don't think we need this esModuleInterop
flag? right?
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.
we need that to be true to avoid the complain from Typescript. By default, it is set to false
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.
left some non-blocking comments.
We had a discussion today and we noticed the internal-lib-build
build script is not working correctly, the typescript declaration files are not generated in published package. We agree to fix that in a separate PR.
Description
This PR implemented
useShopperCategories
,useShopperCategory
,useShopperProduct
,useShopperProduct
Types of Changes
Changes
How to Test-Drive This PR
Provider
hereChecklists
General
Accessibility Compliance
You must check off all items in one of the follow two lists:
or...
Localization