Skip to content
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

[CartProvider]: Add requirement that it must be a descendant of ShopifyProvider #744

Merged
merged 4 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@
"url": "/api/hydrogen-react/hooks/useCart"
}
],
"description": "\n The `CartProvider` component synchronizes the state of the Storefront API Cart and a customer's cart, and allows you to more easily manipulate the cart by adding, removing, and updating it. It could be placed at the root of your app so that your whole app is able to use the `useCart()` hook anywhere.\n\nThere are props that trigger when a call to the Storefront API is made, such as `onLineAdd={}` when a line is added to the cart. There are also props that trigger when a call to the Storefront API is completed, such as `onLineAddComplete={}` when the fetch request for adding a line to the cart completes.\n ",
"description": "\n The `CartProvider` component synchronizes the state of the Storefront API Cart and a customer's cart, and allows you to more easily manipulate the cart by adding, removing, and updating it. It could be placed at the root of your app so that your whole app is able to use the `useCart()` hook anywhere.\n\nThere are props that trigger when a call to the Storefront API is made, such as `onLineAdd={}` when a line is added to the cart. There are also props that trigger when a call to the Storefront API is completed, such as `onLineAddComplete={}` when the fetch request for adding a line to the cart completes.\n\nThe `CartProvider` component must be a descendant of the `ShopifyProvider` component.\n ",
"type": "component",
"defaultExample": {
"description": "I am the default example",
Expand Down
2 changes: 1 addition & 1 deletion packages/hydrogen-react/src/CartProvider.doc.ts
mcvinci marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const data: ReferenceEntityTemplateSchema = {
},
],
description: `
The \`CartProvider\` component synchronizes the state of the Storefront API Cart and a customer's cart, and allows you to more easily manipulate the cart by adding, removing, and updating it. It could be placed at the root of your app so that your whole app is able to use the \`useCart()\` hook anywhere.\n\nThere are props that trigger when a call to the Storefront API is made, such as \`onLineAdd={}\` when a line is added to the cart. There are also props that trigger when a call to the Storefront API is completed, such as \`onLineAddComplete={}\` when the fetch request for adding a line to the cart completes.
The \`CartProvider\` component synchronizes the state of the Storefront API Cart and a customer's cart, and allows you to more easily manipulate the cart by adding, removing, and updating it. It could be placed at the root of your app so that your whole app is able to use the \`useCart()\` hook anywhere.\n\nThere are props that trigger when a call to the Storefront API is made, such as \`onLineAdd={}\` when a line is added to the cart. There are also props that trigger when a call to the Storefront API is completed, such as \`onLineAddComplete={}\` when the fetch request for adding a line to the cart completes.\n\nThe \`CartProvider\` component must be a descendant of the \`ShopifyProvider\` component.
mcvinci marked this conversation as resolved.
Show resolved Hide resolved
`,
type: 'component',
defaultExample: {
Expand Down
2 changes: 2 additions & 0 deletions packages/hydrogen-react/src/CartProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ type CartProviderProps = {
*
* There are props that trigger when a call to the Storefront API is made, such as `onLineAdd={}` when a line is added to the cart.
* There are also props that trigger when a call to the Storefront API is completed, such as `onLineAddComplete={}` when the fetch request for adding a line to the cart completes.
*
* The `CartProvider` component must be a descendant of the `ShopifyProvider` component.
*/
export function CartProvider({
children,
Expand Down