diff --git a/.changeset/large-swans-rule.md b/.changeset/large-swans-rule.md new file mode 100644 index 0000000000..f2a5f3cf14 --- /dev/null +++ b/.changeset/large-swans-rule.md @@ -0,0 +1,5 @@ +--- +"medusa-react": patch +--- + +fix(medusa-react): Allow setting maxRetries on MedusaProvider diff --git a/packages/medusa-react/src/contexts/medusa.tsx b/packages/medusa-react/src/contexts/medusa.tsx index 0cec47ed6f..eb5cafd04a 100644 --- a/packages/medusa-react/src/contexts/medusa.tsx +++ b/packages/medusa-react/src/contexts/medusa.tsx @@ -32,6 +32,11 @@ interface MedusaProviderProps { * available within the request */ publishableApiKey?: string + /** + * Number of times to retry a request if it fails + * @default 3 + */ + maxRetries?: number customHeaders?: Record } @@ -41,14 +46,15 @@ export const MedusaProvider = ({ apiKey, publishableApiKey, customHeaders, + maxRetries = 3, children, }: MedusaProviderProps) => { const medusaClient = new Medusa({ baseUrl, - maxRetries: 0, + maxRetries, apiKey, publishableApiKey, - customHeaders + customHeaders, }) return (