diff --git a/src/renderers/CRUD.tsx b/src/renderers/CRUD.tsx index 0c41e92fa..5cbf82b40 100644 --- a/src/renderers/CRUD.tsx +++ b/src/renderers/CRUD.tsx @@ -520,7 +520,18 @@ export default class CRUD extends React.Component { } else if ( props.api && nextProps.api && - isApiOutdated(props.api, nextProps.api, props.data, nextProps.data) + isApiOutdated( + props.api, + nextProps.api, + store.fetchCtxOf(props.data, { + pageField: props.pageField, + perPageField: props.perPageField + }), + store.fetchCtxOf(nextProps.data, { + pageField: nextProps.pageField, + perPageField: nextProps.perPageField + }) + ) ) { this.dataInvalid = true; } diff --git a/src/store/crud.ts b/src/store/crud.ts index db0021139..b38f4eff9 100644 --- a/src/store/crud.ts +++ b/src/store/crud.ts @@ -73,6 +73,21 @@ export const CRUDStore = ServiceStore.named('CRUDStore') get selectedItemsAsArray() { return self.selectedItems.concat(); + }, + + fetchCtxOf( + data: any, + options: { + pageField?: string; + perPageField?: string; + } + ) { + return createObject(data, { + ...self.query, + [options.pageField || 'page']: self.page, + [options.perPageField || 'perPage']: self.perPage, + ...data + }); } })) .actions(self => {