Merge pull request #1067 from sharetribe/inbox-page-uses-sparse-fields

InboxPage: use sparse fields to improve query performance
This commit is contained in:
Vesa Luusua 2019-04-15 11:28:42 +03:00 committed by GitHub
commit 0f9c74be68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View file

@ -14,6 +14,9 @@ way to update this template, but currently, we follow a pattern:
## Upcoming version 2019-XX-XX
- [add] Use sparse fields on InboxPage query to reduce data load.
[#1067](https://github.com/sharetribe/flex-template-web/pull/1067)
- NOTE: if you need more fields on `InboxPage`, you need to add those to `loadData` function.
- [add] Use sparse fields on SearchPage to reduce data load.
[#1066](https://github.com/sharetribe/flex-template-web/pull/1066)
- NOTE: if you need more fields on `ListingCard` than title, price and geolocation - you need to

View file

@ -94,6 +94,14 @@ export const loadData = (params, search) => (dispatch, getState, sdk) => {
only: onlyFilter,
lastTransitions: TRANSITIONS,
include: ['provider', 'provider.profileImage', 'customer', 'customer.profileImage', 'booking'],
'fields.transaction': [
'lastTransition',
'lastTransitionedAt',
'transitions',
'payinTotal',
'payoutTotal',
],
'fields.user': ['profile.displayName', 'profile.abbreviatedName'],
'fields.image': ['variants.square-small', 'variants.square-small2x'],
page,
per_page: INBOX_PAGE_SIZE,

View file

@ -339,7 +339,7 @@ propTypes.transaction = shape({
id: propTypes.uuid.isRequired,
type: propTypes.value('transaction').isRequired,
attributes: shape({
createdAt: instanceOf(Date).isRequired,
createdAt: instanceOf(Date),
lastTransitionedAt: instanceOf(Date).isRequired,
lastTransition: oneOf(TRANSITIONS).isRequired,
@ -357,7 +357,7 @@ propTypes.transaction = shape({
lineTotal: propTypes.money.isRequired,
reversal: bool.isRequired,
})
).isRequired,
),
transitions: arrayOf(propTypes.transition).isRequired,
}),
booking: propTypes.booking,