diff --git a/web/src/js/ducks/eventLog.js b/web/src/js/ducks/eventLog.js index 1c9d217c8..4eba8b54b 100644 --- a/web/src/js/ducks/eventLog.js +++ b/web/src/js/ducks/eventLog.js @@ -103,7 +103,7 @@ export function handleWsMsg(msg) { } /** - * @private + * @public websocket */ export function fetchData() { return dispatch => { diff --git a/web/src/js/ducks/flows.js b/web/src/js/ducks/flows.js index aad82de2a..4b4b2a88b 100644 --- a/web/src/js/ducks/flows.js +++ b/web/src/js/ducks/flows.js @@ -122,30 +122,6 @@ export function selectFlow(id) { } } -/** - * @public websocket - */ -export function handleWsMsg(msg) { - if (msg.cmd === WS_CMD_RESET) { - return fetchData() - } - return { type: WS_MSG, msg } -} - -/** - * @public websocket - */ -export function fetchData() { - return dispatch => { - dispatch(request()) - - return fetch('/flows') - .then(res => res.json()) - .then(json => dispatch(receive(json.data))) - .catch(error => dispatch(fetchError(error))) - } -} - /** * @public */ @@ -228,6 +204,32 @@ export function upload(file) { return { type: REQUEST_ACTION } } +/** + * This action creater takes all WebSocket events + * + * @public websocket + */ +export function handleWsMsg(msg) { + if (msg.cmd === WS_CMD_RESET) { + return fetchData() + } + return { type: WS_MSG, msg } +} + +/** + * @public websocket + */ +export function fetchData() { + return dispatch => { + dispatch(request()) + + return fetch('/flows') + .then(res => res.json()) + .then(json => dispatch(receive(json.data))) + .catch(error => dispatch(fetchError(error))) + } +} + /** * @private */ diff --git a/web/src/js/ducks/utils/list.js b/web/src/js/ducks/utils/list.js index 1c1d9692c..c23adfbd0 100644 --- a/web/src/js/ducks/utils/list.js +++ b/web/src/js/ducks/utils/list.js @@ -87,13 +87,14 @@ export default function reduce(state = defaultState, action) { } case RECEIVE: - return { + return state[SYM_PENDING].reduce(reduce, { ...state, + [SYM_PENDING]: [], isFetching: false, raw: action.list, data: action.list.filter(state[SYM_FILTER]).sort(state[SYM_SORTER]), byId: _.fromPairs(action.list.map(item => [item.id, item])), - } + }) default: return state