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:
Kasper Fabricius Kristensen authored and GitHub committed 2023-01-24 12:55:24 +00:00
1 parent a248bf6e4f
commit 6293fccc65
15 files changed
+21 -14

No files matched your search

@@ -23,7 +23,9 @@ export const buildOptions = <
}
if (queryKey !== undefined) {
queryClient.invalidateQueries(queryKey)
queryKey.forEach((key) => {
queryClient.invalidateQueries({ queryKey: key as QueryKey })
})
}
},
}