Reduce queries in Inbox Panel. (https://github.com/woocommerce/woocommerce-admin/pull/3977)
* Notes panel: only request fields needed for render. * Avoid retrieving post meta for WC_Admin_Note objects. It's an ID collision anyhow.
This commit is contained in:
parent
0e94da6160
commit
267c95e8d5
|
@ -126,6 +126,18 @@ export default compose(
|
|||
orderby: 'date',
|
||||
order: 'desc',
|
||||
status: 'unactioned',
|
||||
_fields: [
|
||||
'id',
|
||||
'name',
|
||||
'title',
|
||||
'content',
|
||||
'type',
|
||||
'icon',
|
||||
'status',
|
||||
'actions',
|
||||
'date_created',
|
||||
'date_created_gmt',
|
||||
],
|
||||
};
|
||||
|
||||
const notes = getNotes( inboxQuery );
|
||||
|
|
|
@ -151,6 +151,18 @@ class WC_Admin_Note extends \WC_Data {
|
|||
|
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns all data for this object.
|
||||
*
|
||||
* Override \WC_Data::get_data() to avoid errantly including meta data
|
||||
* from ID collisions with the posts table.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_data() {
|
||||
return array_merge( array( 'id' => $this->get_id() ), $this->data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get note name.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue