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
2023-01-24 07:55:24 -05:00
committed by GitHub
parent a248bf6e4f
commit 6293fccc65
15 changed files with 21 additions and 14 deletions

View File

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