Merge pull request woocommerce/woocommerce-admin#2488 from woocommerce/fix/table-ext-error
Table extension: fix page error and jsDoc
This commit is contained in:
commit
0654bcaee2
|
@ -118,7 +118,7 @@ class ReportTable extends Component {
|
|||
* @param {array} reportTableData.rows - table rows data.
|
||||
* @param {object} reportTableData.totals - total aggregates for request.
|
||||
* @param {array} reportTableData.summary - summary numbers data.
|
||||
* @param {array} reportTableData.items - response from api requerst.
|
||||
* @param {object} reportTableData.items - response from api requerst.
|
||||
*/
|
||||
const { headers, ids, rows, summary } = applyFilters( TABLE_FILTER, {
|
||||
endpoint,
|
||||
|
|
|
@ -7,7 +7,12 @@ import { addFilter } from '@wordpress/hooks';
|
|||
import { Rating } from '@woocommerce/components';
|
||||
|
||||
addFilter( 'woocommerce_admin_report_table', 'plugin-domain', reportTableData => {
|
||||
if ( 'products' !== reportTableData.endpoint || ! reportTableData.items.data.length ) {
|
||||
if (
|
||||
'products' !== reportTableData.endpoint ||
|
||||
! reportTableData.items ||
|
||||
! reportTableData.items.data ||
|
||||
! reportTableData.items.data.length
|
||||
) {
|
||||
return reportTableData;
|
||||
}
|
||||
|
||||
|
@ -33,7 +38,9 @@ addFilter( 'woocommerce_admin_report_table', 'plugin-domain', reportTableData =>
|
|||
},
|
||||
// average_rating can be found on extended_info on productData.
|
||||
{
|
||||
display: <Rating rating={ Number( product.extended_info.average_rating ) } totalStars={ 5 } />,
|
||||
display: (
|
||||
<Rating rating={ Number( product.extended_info.average_rating ) } totalStars={ 5 } />
|
||||
),
|
||||
value: product.extended_info.average_rating,
|
||||
},
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue