feat(dashboard): display inventory levels in variants table (#7694)
* feat: display inventory levels in variants table * fix: display conditions and translations * fix: invalidate inventory lists when products are created * fix: translation, fix link definition * fix: revert link * feat: navigation actions * fix: action, refactor * fix: refactor, add check for manage quantity flag * fix: update label
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
import { sdk } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||
import { inventoryItemsQueryKeys } from "./inventory.tsx"
|
||||
|
||||
const PRODUCTS_QUERY_KEY = "products" as const
|
||||
export const productsQueryKeys = queryKeysFactory(PRODUCTS_QUERY_KEY)
|
||||
@@ -254,6 +255,10 @@ export const useCreateProduct = (
|
||||
sdk.admin.product.create(payload),
|
||||
onSuccess: (data: any, variables: any, context: any) => {
|
||||
queryClient.invalidateQueries({ queryKey: productsQueryKeys.lists() })
|
||||
// if `manage_inventory` is true on created variants that will create inventory items automatically
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: inventoryItemsQueryKeys.lists(),
|
||||
})
|
||||
options?.onSuccess?.(data, variables, context)
|
||||
},
|
||||
...options,
|
||||
|
||||
Reference in New Issue
Block a user