diff --git a/imports/plugins/included/product-admin/client/blocks/ProductHeader.js b/imports/plugins/included/product-admin/client/blocks/ProductHeader.js index 336680229a..c0b1ce33d3 100644 --- a/imports/plugins/included/product-admin/client/blocks/ProductHeader.js +++ b/imports/plugins/included/product-admin/client/blocks/ProductHeader.js @@ -13,10 +13,6 @@ import { makeStyles, Box, Divider } from "@material-ui/core"; import useProduct from "../hooks/useProduct"; const useStyles = makeStyles((theme) => ({ - root: { - paddingTop: theme.spacing(2), - paddingBottom: theme.spacing(2) - }, breadcrumbs: { display: "flex", alignItems: "center", @@ -104,12 +100,10 @@ function ProductHeader({ shouldDisplayStatus }) { } return ( -
+ <> -
+ ); } diff --git a/imports/plugins/included/product-admin/client/blocks/VariantList.js b/imports/plugins/included/product-admin/client/blocks/VariantList.js index 6c73c11113..705cf1691f 100644 --- a/imports/plugins/included/product-admin/client/blocks/VariantList.js +++ b/imports/plugins/included/product-admin/client/blocks/VariantList.js @@ -19,17 +19,64 @@ const useStyles = makeStyles((theme) => ({ listItemContainer: { "&:hover $listItemAction": { display: "block" + }, + [theme.breakpoints.up("md")]: { + paddingLeft: theme.spacing(2), + paddingRight: theme.spacing(2) } }, listItem: { - paddingLeft: theme.spacing(7) + "&$selected $listItemPrimaryText, &$selected:hover $listItemPrimaryText": { + fontWeight: theme.typography.fontWeightBold + }, + [theme.breakpoints.up("xs")]: { + paddingLeft: theme.spacing(8) + }, + [theme.breakpoints.up("md")]: { + "paddingLeft": theme.spacing(7), + "&$selected": { + backgroundColor: "transparent" + }, + "&$selected:hover": { + backgroundColor: "white" + } + } + }, + listItemButton: { + "transition": theme.transitions.create("background-color", { + duration: theme.transitions.duration.shortest + }), + "&:hover": { + "textDecoration": "none", + "backgroundColor": "white", + "boxShadow": theme.shadows[2], + "borderRadius": theme.shape.borderRadius, + "@media (hover: none)": { + backgroundColor: "transparent", + boxShadow: "none", + borderRadius: 0 + } + } }, nested: { - paddingLeft: theme.spacing(8) + [theme.breakpoints.up("md")]: { + paddingLeft: theme.spacing(6) + }, + [theme.breakpoints.up("xs")]: { + paddingLeft: theme.spacing(4) + } }, listItemAction: { - display: "none" - } + [theme.breakpoints.up("md")]: { + display: "none" + } + }, + /* Pseudo-class applied to the `component`'s `focusVisibleClassName` prop if `button={true}`. */ + focusVisible: {}, + /* Pseudo-class applied to the `ListItemText`'s `primary label` when `selected`. */ + listItemPrimaryText: {}, + /* Pseudo-class applied to the root element if `selected={true}`. */ + selected: {} })); /** @@ -51,13 +98,14 @@ function getItemSecondaryLabel({ isVisible }) { */ export default function VariantList() { const { + currentVariant, onArchiveProductVariants, onCreateVariant, onToggleVariantVisibility, onCloneProductVariants, onRestoreProduct, product, - variant: currentVariant + variant: variantProp } = useProduct(); const classes = useStyles(); const history = useHistory(); @@ -65,11 +113,11 @@ export default function VariantList() { useEffect(() => { - if (currentVariant) { - setExpandedIds((prevState) => [...prevState, currentVariant._id]); + if (variantProp) { + setExpandedIds((prevState) => [...prevState, variantProp._id]); } }, [ - currentVariant + variantProp ]); const renderVariantTree = useCallback((variants, parentVariant) => { @@ -95,17 +143,25 @@ export default function VariantList() { toggleExpand(variant._id) }} ContainerComponent={VariantListItemContainer} + classes={{ + root: classes.listItem, + button: classes.listItemButton, + selected: classes.selected + }} className={clsx({ - [classes.listItem]: true, - [classes.nested]: Boolean(parentVariant) + // [classes.nested]: Boolean(parentVariant) })} button + selected={currentVariant && (currentVariant._id === variant._id)} onClick={() => { const url = getPDPUrl(product._id, variant._id, parentVariant && parentVariant._id); history.push(url); @@ -116,6 +172,9 @@ export default function VariantList() { }} > @@ -153,6 +212,7 @@ export default function VariantList() { }, [ expandedIds, classes, + currentVariant, product, onArchiveProductVariants, onCreateVariant, diff --git a/imports/plugins/included/product-admin/client/components/VariantListItemContainer.js b/imports/plugins/included/product-admin/client/components/VariantListItemContainer.js index cc7eb46f06..2bda63e46f 100644 --- a/imports/plugins/included/product-admin/client/components/VariantListItemContainer.js +++ b/imports/plugins/included/product-admin/client/components/VariantListItemContainer.js @@ -9,10 +9,10 @@ import { import ChevronDown from "mdi-material-ui/ChevronDown"; import ChevronRight from "mdi-material-ui/ChevronRight"; -const useStyles = makeStyles(() => ({ +const useStyles = makeStyles((theme) => ({ expandButton: { position: "absolute", - left: 0, + left: theme.spacing(2), top: "50%", transform: "translateY(-50%)", zIndex: 1 diff --git a/imports/plugins/included/product-admin/client/graphql/fragments/productVariant.js b/imports/plugins/included/product-admin/client/graphql/fragments/productVariant.js new file mode 100644 index 0000000000..1befe41c37 --- /dev/null +++ b/imports/plugins/included/product-admin/client/graphql/fragments/productVariant.js @@ -0,0 +1,33 @@ +import gql from "graphql-tag"; + +export default gql` + fragment ProductVariant on ProductVariant { + _id + attributeLabel + barcode + height + index + isDeleted + isVisible + length + metafields { + key + value + } + minOrderQuantity + optionTitle + originCountry + shop { + _id + } + sku + title + updatedAt + weight + width + isTaxable + taxCode + taxDescription + } +`; + diff --git a/imports/plugins/included/product-admin/client/graphql/fragments/productWithVariants.js b/imports/plugins/included/product-admin/client/graphql/fragments/productWithVariants.js new file mode 100644 index 0000000000..f1cdb2c846 --- /dev/null +++ b/imports/plugins/included/product-admin/client/graphql/fragments/productWithVariants.js @@ -0,0 +1,48 @@ +import gql from "graphql-tag"; +import ProductVariant from "./productVariant"; + +export default gql` + fragment Product on Product { + _id + currentProductHash + description + isDeleted + isVisible + metaDescription + metafields { + key + value + } + originCountry + pageTitle + productType + publishedAt + publishedProductHash + shop { + _id + } + slug + socialMetadata { + message + service + } + supportedFulfillmentTypes + tagIds + tags { + nodes { + _id + name + } + } + title + updatedAt + vendor + variants { + ...ProductVariant + options { + ...ProductVariant + } + } + } + ${ProductVariant} +`; diff --git a/imports/plugins/included/product-admin/client/graphql/mutations/archiveProductVariants.js b/imports/plugins/included/product-admin/client/graphql/mutations/archiveProductVariants.js new file mode 100644 index 0000000000..fb8f65ba17 --- /dev/null +++ b/imports/plugins/included/product-admin/client/graphql/mutations/archiveProductVariants.js @@ -0,0 +1,11 @@ +import gql from "graphql-tag"; + +export default gql` + mutation archiveProductVariants($input: ArchiveProductVariantsInput!) { + archiveProductVariants(input: $input) { + variants { + _id + } + } + } +`; diff --git a/imports/plugins/included/product-admin/client/graphql/mutations/cloneProductVariants.js b/imports/plugins/included/product-admin/client/graphql/mutations/cloneProductVariants.js new file mode 100644 index 0000000000..779e9ed407 --- /dev/null +++ b/imports/plugins/included/product-admin/client/graphql/mutations/cloneProductVariants.js @@ -0,0 +1,11 @@ +import gql from "graphql-tag"; + +export default gql` + mutation cloneProductVariants($input: CloneProductVariantsInput!) { + cloneProductVariants(input: $input) { + variants { + _id + } + } + } +`; diff --git a/imports/plugins/included/product-admin/client/graphql/mutations/createProductVariant.js b/imports/plugins/included/product-admin/client/graphql/mutations/createProductVariant.js new file mode 100644 index 0000000000..a196687d6d --- /dev/null +++ b/imports/plugins/included/product-admin/client/graphql/mutations/createProductVariant.js @@ -0,0 +1,13 @@ +import gql from "graphql-tag"; +import ProductVariant from "../fragments/productVariant"; + +export default gql` + mutation createProductVariant($input: CreateProductVariantInput!) { + createProductVariant(input: $input) { + variant { + ...ProductVariant + } + } + } + ${ProductVariant} +`; diff --git a/imports/plugins/included/product-admin/client/graphql/mutations/updateProduct.js b/imports/plugins/included/product-admin/client/graphql/mutations/updateProduct.js index 5916d8d19b..a2010ab6a3 100644 --- a/imports/plugins/included/product-admin/client/graphql/mutations/updateProduct.js +++ b/imports/plugins/included/product-admin/client/graphql/mutations/updateProduct.js @@ -1,11 +1,13 @@ import gql from "graphql-tag"; +import Product from "../fragments/productWithVariants"; export default gql` mutation updateProduct($input: UpdateProductInput!){ updateProduct(input: $input){ product { - isVisible + ...Product } } -} + } + ${Product} `; diff --git a/imports/plugins/included/product-admin/client/graphql/mutations/updateProductVariant.js b/imports/plugins/included/product-admin/client/graphql/mutations/updateProductVariant.js new file mode 100644 index 0000000000..59fe090c0f --- /dev/null +++ b/imports/plugins/included/product-admin/client/graphql/mutations/updateProductVariant.js @@ -0,0 +1,13 @@ +import gql from "graphql-tag"; +import ProductVariant from "../fragments/productVariant"; + +export default gql` + mutation updateProductVariant($input: UpdateProductVariantInput!) { + updateProductVariant(input: $input) { + variant { + ...ProductVariant + } + } + } + ${ProductVariant} +`; diff --git a/imports/plugins/included/product-admin/client/graphql/mutations/updateProductVariantPrices.js b/imports/plugins/included/product-admin/client/graphql/mutations/updateProductVariantPrices.js new file mode 100644 index 0000000000..04249abe6a --- /dev/null +++ b/imports/plugins/included/product-admin/client/graphql/mutations/updateProductVariantPrices.js @@ -0,0 +1,13 @@ +import gql from "graphql-tag"; + +export default gql` + mutation updateProductVariantPrices($input: UpdateProductVariantPricesInput!) { + updateProductVariantPrices(input: $input) { + variant { + _id + price + compareAtPrice + } + } + } +`; diff --git a/imports/plugins/included/product-admin/client/graphql/queries/product.js b/imports/plugins/included/product-admin/client/graphql/queries/product.js new file mode 100644 index 0000000000..17f619fdd2 --- /dev/null +++ b/imports/plugins/included/product-admin/client/graphql/queries/product.js @@ -0,0 +1,11 @@ +import gql from "graphql-tag"; +import Product from "../fragments/productWithVariants"; + +export default gql` + query product($productId: ID!, $shopId: ID!) { + product(productId: $productId, shopId: $shopId) { + ...Product + } + } + ${Product} +`; diff --git a/imports/plugins/included/product-admin/client/hooks/CreateProductVariantMutation.js b/imports/plugins/included/product-admin/client/hooks/CreateProductVariantMutation.js deleted file mode 100644 index 0b93ac6305..0000000000 --- a/imports/plugins/included/product-admin/client/hooks/CreateProductVariantMutation.js +++ /dev/null @@ -1,100 +0,0 @@ -import gql from "graphql-tag"; - -export default gql` - mutation createProductVariant($input: CreateProductVariantInput!) { - createProductVariant(input: $input) { - product { - _id - currentProductHash - description - isDeleted - isVisible - metaDescription - metafields { - key - value - } - originCountry - pageTitle - productType - publishedAt - publishedProductHash - shop { - _id - } - slug - socialMetadata { - message - service - } - supportedFulfillmentTypes - tagIds - tags { - nodes { - _id - name - } - } - title - updatedAt - vendor - variants { - _id - attributeLabel - barcode - height - index - isDeleted - isVisible - length - metafields { - key - value - } - minOrderQuantity - optionTitle - originCountry - shop { - _id - } - sku - title - updatedAt - weight - width - isTaxable - taxCode - taxDescription - options { - _id - attributeLabel - barcode - height - index - isDeleted - isVisible - length - metafields { - key - value - } - minOrderQuantity - optionTitle - originCountry - shop { - _id - } - sku - title - updatedAt - weight - width - isTaxable - taxCode - taxDescription - } - } - } - } - } -`; diff --git a/imports/plugins/included/product-admin/client/hooks/ProductQuery.js b/imports/plugins/included/product-admin/client/hooks/ProductQuery.js deleted file mode 100644 index 919510adc9..0000000000 --- a/imports/plugins/included/product-admin/client/hooks/ProductQuery.js +++ /dev/null @@ -1,133 +0,0 @@ -import gql from "graphql-tag"; - -export default gql` - query product($productId: ID!, $shopId: ID!) { - product(productId: $productId, shopId: $shopId) { - _id - currentProductHash - description - isDeleted - isVisible - media { - _id - URLs { - small - medium - large - original - thumbnail - } - } - metaDescription - metafields { - key - value - } - originCountry - pageTitle - productType - publishedAt - publishedProductHash - shop { - _id - } - shouldAppearInSitemap - slug - socialMetadata { - message - service - } - supportedFulfillmentTypes - tagIds - tags { - nodes { - _id - name - } - } - title - updatedAt - vendor - variants { - _id - attributeLabel - barcode - compareAtPrice - height - index - isDeleted - isVisible - length - media { - _id - URLs { - small - medium - large - original - thumbnail - } - } - metafields { - key - value - } - minOrderQuantity - optionTitle - originCountry - price - shop { - _id - } - sku - title - updatedAt - weight - width - isTaxable - taxCode - taxDescription - options { - _id - attributeLabel - barcode - compareAtPrice - height - index - isDeleted - isVisible - length - media { - _id - URLs { - small - medium - large - original - thumbnail - } - } - metafields { - key - value - } - minOrderQuantity - optionTitle - originCountry - price - shop { - _id - } - sku - title - updatedAt - weight - width - isTaxable - taxCode - taxDescription - } - } - } - } -`; diff --git a/imports/plugins/included/product-admin/client/hooks/UpdateProductMutation.js b/imports/plugins/included/product-admin/client/hooks/UpdateProductMutation.js deleted file mode 100644 index 00d7a74be0..0000000000 --- a/imports/plugins/included/product-admin/client/hooks/UpdateProductMutation.js +++ /dev/null @@ -1,101 +0,0 @@ -import gql from "graphql-tag"; - -export default gql` - mutation updateProduct($input: UpdateProductInput!) { - updateProduct(input: $input) { - product { - _id - currentProductHash - description - isDeleted - isVisible - metaDescription - metafields { - key - value - } - originCountry - pageTitle - productType - publishedAt - publishedProductHash - shop { - _id - } - shouldAppearInSitemap - slug - socialMetadata { - message - service - } - supportedFulfillmentTypes - tagIds - tags { - nodes { - _id - name - } - } - title - updatedAt - vendor - variants { - _id - attributeLabel - barcode - height - index - isDeleted - isVisible - length - metafields { - key - value - } - minOrderQuantity - optionTitle - originCountry - shop { - _id - } - sku - title - updatedAt - weight - width - isTaxable - taxCode - taxDescription - options { - _id - attributeLabel - barcode - height - index - isDeleted - isVisible - length - metafields { - key - value - } - minOrderQuantity - optionTitle - originCountry - shop { - _id - } - sku - title - updatedAt - weight - width - isTaxable - taxCode - taxDescription - } - } - } - } - } -`; diff --git a/imports/plugins/included/product-admin/client/hooks/UpdateProductVariantMutation.js b/imports/plugins/included/product-admin/client/hooks/UpdateProductVariantMutation.js deleted file mode 100644 index 2e6383c76a..0000000000 --- a/imports/plugins/included/product-admin/client/hooks/UpdateProductVariantMutation.js +++ /dev/null @@ -1,36 +0,0 @@ -import gql from "graphql-tag"; - -export default gql` - mutation updateProductVariant($input: UpdateProductVariantInput!) { - updateProductVariant(input: $input) { - variant { - _id - attributeLabel - barcode - height - index - isDeleted - isVisible - length - metafields { - key - value - } - minOrderQuantity - optionTitle - originCountry - shop { - _id - } - sku - title - updatedAt - weight - width - isTaxable - taxCode - taxDescription - } - } - } -`; diff --git a/imports/plugins/included/product-admin/client/hooks/useProduct.js b/imports/plugins/included/product-admin/client/hooks/useProduct.js index 55590dff32..781ea3a2fe 100644 --- a/imports/plugins/included/product-admin/client/hooks/useProduct.js +++ b/imports/plugins/included/product-admin/client/hooks/useProduct.js @@ -1,98 +1,22 @@ import { useState, useCallback } from "react"; -import gql from "graphql-tag"; import { useHistory, useParams } from "react-router-dom"; import { useMutation, useQuery } from "@apollo/react-hooks"; import { Meteor } from "meteor/meteor"; import i18next from "i18next"; import useCurrentShopId from "/imports/client/ui/hooks/useCurrentShopId"; import { useSnackbar } from "notistack"; -import PRODUCT_QUERY from "./ProductQuery"; -import UPDATE_PRODUCT from "./UpdateProductMutation"; -import UpdateProductVariantMutation from "./UpdateProductVariantMutation"; - -const ARCHIVE_PRODUCTS = gql` - mutation archiveProducts($input: ArchiveProductsInput!) { - archiveProducts(input: $input) { - products { - _id - } - } - } -`; - -const CLONE_PRODUCTS = gql` - mutation cloneProducts($input: CloneProductsInput!) { - cloneProducts(input: $input) { - products { - _id - } - } - } -`; - -const CREATE_VARIANT = gql` -mutation createProductVariant($input: CreateProductVariantInput!) { - createProductVariant(input: $input) { - variant { - _id - } - } -} -`; - -const CLONE_PRODUCT_VARIANTS = gql` - mutation cloneProducts($input: CloneProductVariantsInput!) { - cloneProductVariants(input: $input) { - variants { - _id - } - } - } -`; - -const ARCHIVE_PRODUCT_VARIANTS = gql` - mutation cloneProducts($input: ArchiveProductVariantsInput!) { - archiveProductVariants(input: $input) { - variants { - _id - } - } - } -`; - -const PUBLISH_TO_CATALOG = gql` - mutation ($productIds: [ID]!) { - publishProductsToCatalog(productIds: $productIds) { - product { - productId - title - isDeleted - supportedFulfillmentTypes - variants { - _id - title - options { - _id - title - } - } - } - } - } -`; - -const updateProductVariantPricesMutation = gql` - mutation updateProductVariantPrices($input: UpdateProductVariantPricesInput!) { - updateProductVariantPrices(input: $input) { - variant { - _id - price - compareAtPrice - } - } - } -`; +// GraphQL Queries / Mutations +import ArchiveProductsMutation from "../graphql/mutations/archiveProducts"; +import ArchiveProductVariantsMutation from "../graphql/mutations/archiveProductVariants"; +import CloneProductsMutation from "../graphql/mutations/cloneProducts"; +import CloneProductVariantsMutation from "../graphql/mutations/cloneProductVariants"; +import CreateProductVariantMutation from "../graphql/mutations/createProductVariant"; +import ProductQuery from "../graphql/queries/product"; +import PublishProductsToCatalogMutation from "../graphql/mutations/publishProductsToCatalog"; +import UpdateProductMutation from "../graphql/mutations/updateProduct"; +import UpdateProductVariantMutation from "../graphql/mutations/updateProductVariant"; +import UpdateProductVariantPricesMutation from "../graphql/mutations/updateProductVariantPrices"; /** * Restore an archived product @@ -123,15 +47,15 @@ function useProduct(args = {}) { const [newMetaField, setNewMetaField] = useState({ key: "", value: "" }); const history = useHistory(); const routeParams = useParams(); - const [updateProduct] = useMutation(UPDATE_PRODUCT); - const [archiveProducts] = useMutation(ARCHIVE_PRODUCTS); - const [cloneProducts] = useMutation(CLONE_PRODUCTS); - const [createProductVariant] = useMutation(CREATE_VARIANT); + const [updateProduct] = useMutation(UpdateProductMutation); + const [archiveProducts] = useMutation(ArchiveProductsMutation); + const [cloneProducts] = useMutation(CloneProductsMutation); + const [createProductVariant] = useMutation(CreateProductVariantMutation); const [updateProductVariant] = useMutation(UpdateProductVariantMutation); - const [cloneProductVariants] = useMutation(CLONE_PRODUCT_VARIANTS); - const [archiveProductVariants] = useMutation(ARCHIVE_PRODUCT_VARIANTS); - const [publishProductsToCatalog] = useMutation(PUBLISH_TO_CATALOG); - const [updateProductVariantPrices] = useMutation(updateProductVariantPricesMutation); + const [cloneProductVariants] = useMutation(CloneProductVariantsMutation); + const [archiveProductVariants] = useMutation(ArchiveProductVariantsMutation); + const [publishProductsToCatalog] = useMutation(PublishProductsToCatalogMutation); + const [updateProductVariantPrices] = useMutation(UpdateProductVariantPricesMutation); const [currentShopId] = useCurrentShopId(); @@ -140,18 +64,18 @@ function useProduct(args = {}) { const optionId = routeParams.optionId || optionIdProp; const shopId = routeParams.shopId || currentShopId; - const { data: productQueryResult, isLoading, refetch: refetchProduct } = useQuery(PRODUCT_QUERY, { + const { data: productQueryResult, isLoading, refetch: refetchProduct } = useQuery(ProductQuery, { variables: { productId, shopId - } + }, + skip: !shopId }); const { product } = productQueryResult || {}; let variant; let option; - // let parentVariant; if (product && variantId) { variant = product.variants.find(({ _id }) => _id === variantId); @@ -181,12 +105,13 @@ function useProduct(args = {}) { const onArchiveProduct = useCallback(async (productLocal, redirectUrl) => { try { await archiveProducts({ variables: { input: { shopId, productIds: [productLocal] } } }); - Alerts.toast(i18next.t("productDetailEdit.archiveProductsSuccess"), "success"); + enqueueSnackbar(i18next.t("productDetailEdit.archiveProductsSuccess"), { variant: "success" }); history.push(redirectUrl); } catch (error) { - Alerts.toast(i18next.t("productDetailEdit.archiveProductsFail", { err: error }), "error"); + enqueueSnackbar(i18next.t("productDetailEdit.archiveProductsFail"), { variant: "success" }); } }, [ + enqueueSnackbar, history, archiveProducts, shopId @@ -255,11 +180,12 @@ function useProduct(args = {}) { } }); - Alerts.toast(i18next.t("productDetailEdit.updateProductFieldSuccess"), "success"); + enqueueSnackbar(i18next.t("productDetailEdit.updateProductFieldSuccess"), { variant: "success" }); } catch (error) { - Alerts.toast(i18next.t("productDetailEdit.updateProductFieldFail", { err: error }), "error"); + enqueueSnackbar(i18next.t("productDetailEdit.updateProductFieldFail"), { variant: "error" }); } }, [ + enqueueSnackbar, product, shopId, updateProduct diff --git a/imports/plugins/included/product-admin/client/layouts/ProductDetail.js b/imports/plugins/included/product-admin/client/layouts/ProductDetail.js index 6e1796bb32..61bfa220e3 100644 --- a/imports/plugins/included/product-admin/client/layouts/ProductDetail.js +++ b/imports/plugins/included/product-admin/client/layouts/ProductDetail.js @@ -43,11 +43,15 @@ function ProductDetail(props) { AppBarComponent={} PrimaryComponent={ <> - + - + diff --git a/imports/plugins/included/simple-inventory/client/useVariantInventory.js b/imports/plugins/included/simple-inventory/client/useVariantInventory.js index 1a4764999b..bffe449364 100644 --- a/imports/plugins/included/simple-inventory/client/useVariantInventory.js +++ b/imports/plugins/included/simple-inventory/client/useVariantInventory.js @@ -148,14 +148,16 @@ function useVariantInventory(args = {}) { }, [enqueueSnackbar, productId, productVariantId, recalculateReservedSimpleInventory, shopId]); const { data: inventoryQueryResult, isLoading: isLoadingInventory, refetch: refetchInventory } = useQuery(getInventoryInfo, { - variables: getInventoryInfoVariables + variables: getInventoryInfoVariables, + skip: !shopId }); const { data: productQueryResult, isLoading: isLoadingProduct, refetch: refetchProduct } = useQuery(productQuery, { variables: { productId, shopId - } + }, + skip: !shopId }); const { product } = productQueryResult || {}; diff --git a/package-lock.json b/package-lock.json index dcf5a3d9c7..9fc405186c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3914,7 +3914,7 @@ "dependencies": { "buffer": { "version": "4.9.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", "requires": { "base64-js": "^1.0.2",