Fix variant create null thumbnail (#1956)
* Fix null thumbnail error * Fix too few hooks rendered on non-existent products & variants
This commit is contained in:
parent
879e1da69e
commit
26f8a776be
3 changed files with 9 additions and 8 deletions
|
@ -235,7 +235,7 @@ const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
|
||||||
<ProductVariantNavigation
|
<ProductVariantNavigation
|
||||||
current={variant?.id}
|
current={variant?.id}
|
||||||
defaultVariantId={defaultVariantId}
|
defaultVariantId={defaultVariantId}
|
||||||
fallbackThumbnail={variant?.product?.thumbnail.url}
|
fallbackThumbnail={variant?.product?.thumbnail?.url}
|
||||||
variants={variant?.product.variants}
|
variants={variant?.product.variants}
|
||||||
onAdd={onAdd}
|
onAdd={onAdd}
|
||||||
onRowClick={(variantId: string) => {
|
onRowClick={(variantId: string) => {
|
||||||
|
|
|
@ -389,9 +389,6 @@ export const ProductUpdate: React.FC<ProductUpdateProps> = ({ id, params }) => {
|
||||||
|
|
||||||
const handleBack = () => navigate(productListUrl());
|
const handleBack = () => navigate(productListUrl());
|
||||||
|
|
||||||
if (product === null) {
|
|
||||||
return <NotFoundPage onBack={handleBack} />;
|
|
||||||
}
|
|
||||||
const handleVariantAdd = () => navigate(productVariantAddUrl(id));
|
const handleVariantAdd = () => navigate(productVariantAddUrl(id));
|
||||||
const handleVariantsAdd = () => navigate(productVariantCreatorUrl(id));
|
const handleVariantsAdd = () => navigate(productVariantCreatorUrl(id));
|
||||||
|
|
||||||
|
@ -520,6 +517,10 @@ export const ProductUpdate: React.FC<ProductUpdateProps> = ({ id, params }) => {
|
||||||
onFetchMore: loadMoreAttributeValues
|
onFetchMore: loadMoreAttributeValues
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (product === null) {
|
||||||
|
return <NotFoundPage onBack={handleBack} />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<WindowTitle title={data?.product?.name} />
|
<WindowTitle title={data?.product?.name} />
|
||||||
|
|
|
@ -197,10 +197,6 @@ export const ProductVariant: React.FC<ProductUpdateProps> = ({
|
||||||
const variant = data?.productVariant;
|
const variant = data?.productVariant;
|
||||||
const channels = createVariantChannels(variant);
|
const channels = createVariantChannels(variant);
|
||||||
|
|
||||||
if (variant === null) {
|
|
||||||
return <NotFoundPage onBack={handleBack} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
const [
|
const [
|
||||||
deactivatePreorder,
|
deactivatePreorder,
|
||||||
deactivatePreoderOpts
|
deactivatePreoderOpts
|
||||||
|
@ -360,6 +356,10 @@ export const ProductVariant: React.FC<ProductUpdateProps> = ({
|
||||||
const attributeValues =
|
const attributeValues =
|
||||||
mapEdgesToItems(searchAttributeValuesOpts?.data?.attribute.choices) || [];
|
mapEdgesToItems(searchAttributeValuesOpts?.data?.attribute.choices) || [];
|
||||||
|
|
||||||
|
if (variant === null) {
|
||||||
|
return <NotFoundPage onBack={handleBack} />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<WindowTitle title={data?.productVariant?.name} />
|
<WindowTitle title={data?.productVariant?.name} />
|
||||||
|
|
Loading…
Reference in a new issue