fix(medusa-react): invalidate products query on category delete (#3485)
This commit is contained in:
1 parent
77d46220c2
commit
4ede91952d
2 files changed
+20
-10
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/medusa-react": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(medusa-react): invalidate products query on category delete
|
||||||
@@ -65,16 +65,16 @@ export const useAdminUpdateProductCategory = (
|
|||||||
return useMutation(
|
return useMutation(
|
||||||
(payload: AdminPostProductCategoriesCategoryReq) =>
|
(payload: AdminPostProductCategoriesCategoryReq) =>
|
||||||
client.admin.productCategories.update(id, payload),
|
client.admin.productCategories.update(id, payload),
|
||||||
buildOptions(
|
buildOptions(
|
||||||
queryClient,
|
queryClient,
|
||||||
[
|
[
|
||||||
adminProductCategoryKeys.lists(),
|
adminProductCategoryKeys.lists(),
|
||||||
adminProductCategoryKeys.detail(id),
|
adminProductCategoryKeys.detail(id),
|
||||||
adminProductKeys.details(),
|
adminProductKeys.details(),
|
||||||
],
|
],
|
||||||
options
|
options
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,11 +95,16 @@ export const useAdminDeleteProductCategory = (
|
|||||||
) => {
|
) => {
|
||||||
const { client } = useMedusa()
|
const { client } = useMedusa()
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
|
|
||||||
return useMutation(
|
return useMutation(
|
||||||
() => client.admin.productCategories.delete(id),
|
() => client.admin.productCategories.delete(id),
|
||||||
buildOptions(
|
buildOptions(
|
||||||
queryClient,
|
queryClient,
|
||||||
[adminProductCategoryKeys.lists(), adminProductCategoryKeys.detail(id)],
|
[
|
||||||
|
adminProductCategoryKeys.lists(),
|
||||||
|
adminProductCategoryKeys.detail(id),
|
||||||
|
adminProductKeys.all
|
||||||
|
],
|
||||||
options
|
options
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user