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:
Albert Juhé Lluveras 2018-12-10 09:51:11 -06:00 committed by GitHub
parent 4cd01a3b3b
commit bb3e66ef32
3 changed files with 7 additions and 3 deletions

View File

@ -118,7 +118,7 @@ ReportTable.propTypes = {
}; };
ReportTable.defaultProps = { ReportTable.defaultProps = {
tableData: null, tableData: {},
tableQuery: {}, tableQuery: {},
}; };

View File

@ -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 = {

View File

@ -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 );