Skip to content

Commit 536eef3

Browse files
committed
Avoid calling fetchPushes from both App and PushList.
1 parent 19fcda5 commit 536eef3

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

tests/ui/job-view/PushList_test.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import jobListFixtureOne from '../mock/job_list/job_1';
1717
import jobListFixtureTwo from '../mock/job_list/job_2';
1818
import { configureStore } from '../../../ui/job-view/redux/configureStore';
1919
import PushList from '../../../ui/job-view/pushes/PushList';
20+
import { fetchPushes } from '../../../ui/job-view/redux/stores/pushes';
2021
import { getApiUrl } from '../../../ui/helpers/url';
2122
import { findJobInstance } from '../../../ui/helpers/job';
2223

@@ -128,6 +129,10 @@ describe('PushList', () => {
128129

129130
const testPushList = () => {
130131
const store = configureStore(history);
132+
133+
// Manually trigger fetchPushes since outside testing the App does it.
134+
store.dispatch(fetchPushes());
135+
131136
return (
132137
<Provider store={store} context={ReactReduxContext}>
133138
<ConnectedRouter history={history} context={ReactReduxContext}>

ui/job-view/pushes/PushList.jsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ class PushList extends React.Component {
2929
}
3030

3131
componentDidMount() {
32-
const { fetchPushes } = this.props;
33-
34-
// Fetch pushes regardless of whether App started the request,
35-
// the Redux action will handle deduplication if needed.
36-
fetchPushes();
3732
this.poll();
3833
}
3934

ui/job-view/redux/stores/pushes.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,10 @@ export const fetchPushes = (
248248
) => {
249249
return async (dispatch, getState) => {
250250
const {
251-
pushes: { pushList, jobMap, oldestPushTimestamp, loadingPushes },
251+
pushes: { pushList, jobMap, oldestPushTimestamp },
252252
router,
253253
} = getState();
254254

255-
// Prevent duplicate requests when already loading initial data.
256-
if (loadingPushes && !setFromchange) {
257-
return;
258-
}
259-
260255
dispatch({ type: LOADING });
261256

262257
const locationSearch = parseQueryParams(window.location.search);

0 commit comments

Comments
 (0)