Fix wrong default data structure in 'getReportTableData' (https://github.com/woocommerce/woocommerce-admin/pull/1042)
* Fix wrong default data structure in 'getReportTableData' * Update tests * Change default prop for tableData from null to an empty object in ReportTable
This commit is contained in:
parent
4cd01a3b3b
commit
bb3e66ef32
|
@ -118,7 +118,7 @@ ReportTable.propTypes = {
|
||||||
};
|
};
|
||||||
|
|
||||||
ReportTable.defaultProps = {
|
ReportTable.defaultProps = {
|
||||||
tableData: null,
|
tableData: {},
|
||||||
tableQuery: {},
|
tableQuery: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -451,7 +451,9 @@ describe( 'getReportTableData()', () => {
|
||||||
const response = {
|
const response = {
|
||||||
isError: false,
|
isError: false,
|
||||||
isRequesting: false,
|
isRequesting: false,
|
||||||
items: [],
|
items: {
|
||||||
|
data: [],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const query = {
|
const query = {
|
||||||
|
|
|
@ -305,7 +305,9 @@ export function getReportTableData( endpoint, urlQuery, select, query = {} ) {
|
||||||
query: tableQuery,
|
query: tableQuery,
|
||||||
isRequesting: false,
|
isRequesting: false,
|
||||||
isError: false,
|
isError: false,
|
||||||
items: [],
|
items: {
|
||||||
|
data: [],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const items = getReportItems( endpoint, tableQuery );
|
const items = getReportItems( endpoint, tableQuery );
|
||||||
|
|
Loading…
Reference in New Issue