Skip to content

Commit 8aa5b9f

Browse files
committed
remove storeInState parameter of fetchPage
1 parent 1f94f18 commit 8aa5b9f

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

src/api/external.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,13 @@ function genThunkOne(config, actions) {
5555
* The results are returned.
5656
*/
5757
function genThunkPage(config, actions) {
58-
function fetchPage(page = 0, ids = [], resourceFilter, storeInState = true, headers) {
58+
function fetchPage(page = 0, ids = [], resourceFilter, headers) {
5959
return async (dispatch) => {
6060
const endpoint = `${config.endpoint(...ids, '')}?page=${page + 1}`;
6161
const resources = await dispatch(fetch.get(endpoint, undefined, headers));
62-
resources[config.plural] = resources.data || [];
62+
resources[config.name] = resources.data || [];
6363
const filteredResources = filterResources(config, resources, resourceFilter);
64-
if (storeInState) {
65-
await dispatch(actions.many(filteredResources, ...ids));
66-
}
64+
await dispatch(actions.many(filteredResources, ...ids));
6765
return filteredResources;
6866
};
6967
}
@@ -79,13 +77,13 @@ function genThunkAll(config, actions, fetchPage) {
7977
return async (dispatch) => {
8078
// Grab first page so we know how many there are.
8179
const resource = await dispatch(
82-
fetchPage(0, ids, resourceFilter, true, options));
80+
fetchPage(0, ids, resourceFilter, options));
8381
const resources = [resource];
8482

8583
// Grab all pages we know about and store them in Redux.
8684
const requests = [];
8785
for (let i = 1; i < resources[0].pages; i += 1) {
88-
requests.push(fetchPage(i, ids, resourceFilter, true, options));
86+
requests.push(fetchPage(i, ids, resourceFilter, options));
8987
}
9088

9189
// Gather all the results for for return to the caller

src/components/PollingWrapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const mapStateToProps = (state) => ({
104104
const mapDispatchToProps = (dispatch) => ({
105105
dispatch,
106106
fetchEventsPage(headers = null) {
107-
return dispatch(api.events.page(0, [], null, true, null, headers));
107+
return dispatch(api.events.page(0, [], null, headers));
108108
},
109109
});
110110
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(PollingWrapper));

src/components/notifications/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class Notifications extends Component {
123123

124124
fetchEventsPage(headers = null) {
125125
const { dispatch } = this.props;
126-
return dispatch(api.events.page(0, [], null, true, null, headers));
126+
return dispatch(api.events.page(0, [], null, headers));
127127
}
128128

129129
render() {
@@ -188,7 +188,7 @@ const mapDispatchToProps = (dispatch) => ({
188188
}
189189
},
190190
fetchEventsPage(headers = null) {
191-
return dispatch(api.events.page(0, [], null, true, null, headers));
191+
return dispatch(api.events.page(0, [], null, headers));
192192
},
193193
});
194194

0 commit comments

Comments
 (0)