Skip to content

Commit

Permalink
Remove `totalCount const
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando Marichal committed Jan 10, 2023
1 parent d88d91c commit e9d7f4d
Showing 1 changed file with 2 additions and 23 deletions.
Expand Up @@ -4,12 +4,7 @@
import { __ } from '@wordpress/i18n';
import { recordEvent } from '@woocommerce/tracks';
import { Link, useFormContext } from '@woocommerce/components';
import { useSelect } from '@wordpress/data';
import {
EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME,
Product,
ProductAttribute,
} from '@woocommerce/data';
import { Product, ProductAttribute } from '@woocommerce/data';

/**
* Internal dependencies
Expand All @@ -36,23 +31,7 @@ export const ProductVariationsSection: React.FC = () => {
)
: [];

const { totalCount } = useSelect(
( select ) => {
const { getProductVariationsTotalCount } = select(
EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME
);
const requestParams = {
product_id: productId,
};
return {
totalCount:
getProductVariationsTotalCount< number >( requestParams ),
};
},
[ productId, options ]
);

if ( options.length === 0 || totalCount === 0 || isNaN( totalCount ) ) {
if ( options.length === 0 ) {
return null;
}

Expand Down

0 comments on commit e9d7f4d

Please sign in to comment.