hotfix(medusa-react): Invalidate query keys on successful mutations (#3099)
**What** - Fixes an issue where query keys weren't invalidated on successful mutations. **How** - Update `buildOptions` function to be called per `QueryKey` instead of passing them all as a single query key, resulting in no matches found. - Fixes imports that aren't compatible with ESM modules.
This commit is contained in:
committed by
GitHub
parent
a248bf6e4f
commit
6293fccc65
@@ -23,7 +23,9 @@ export const buildOptions = <
|
||||
}
|
||||
|
||||
if (queryKey !== undefined) {
|
||||
queryClient.invalidateQueries(queryKey)
|
||||
queryKey.forEach((key) => {
|
||||
queryClient.invalidateQueries({ queryKey: key as QueryKey })
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user