Skip to content

Commit

Permalink
fix(medusa-react): Allow setting maxRetries on MedusaProvider (#5765)
Browse files Browse the repository at this point in the history
* allow settign maxRetries on MedusaProvider

* add changeset

* set default maxRetries to 3
  • Loading branch information
kasperkristensen authored Nov 29, 2023
1 parent f802e24 commit 4e9d954
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/large-swans-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"medusa-react": patch
---

fix(medusa-react): Allow setting maxRetries on MedusaProvider
10 changes: 8 additions & 2 deletions packages/medusa-react/src/contexts/medusa.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, any>
}

Expand All @@ -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 (
<QueryClientProvider {...queryClientProviderProps}>
Expand Down

0 comments on commit 4e9d954

Please sign in to comment.