diff options
| author | Maximilian Hils <git@maximilianhils.com> | 2016-11-09 13:01:25 +0100 |
|---|---|---|
| committer | Maximilian Hils <git@maximilianhils.com> | 2016-11-09 13:01:25 +0100 |
| commit | 77f05178ad23a8bb1f2cc43e1cdcf0593acd43d2 (patch) | |
| tree | 8a13e6257146dc6a535dca220f7cb374cbd91a73 /web/src/js/ducks | |
| parent | a0ddedff6f2e6420ab44a7763132e80a8b8075d5 (diff) | |
| download | mitmproxy-77f05178ad23a8bb1f2cc43e1cdcf0593acd43d2.tar.gz mitmproxy-77f05178ad23a8bb1f2cc43e1cdcf0593acd43d2.tar.bz2 mitmproxy-77f05178ad23a8bb1f2cc43e1cdcf0593acd43d2.zip | |
mitmweb: minor fixes
Diffstat (limited to 'web/src/js/ducks')
| -rw-r--r-- | web/src/js/ducks/flows.js | 6 | ||||
| -rw-r--r-- | web/src/js/ducks/utils/store.js | 16 |
2 files changed, 19 insertions, 3 deletions
diff --git a/web/src/js/ducks/flows.js b/web/src/js/ducks/flows.js index 3375e4bd..d3717533 100644 --- a/web/src/js/ducks/flows.js +++ b/web/src/js/ducks/flows.js @@ -1,6 +1,5 @@ import { fetchApi } from "../utils" -import reduceStore from "./utils/store" -import * as storeActions from "./utils/store" +import reduceStore, * as storeActions from "./utils/store" import Filt from "../filt/filt" import { RequestUtils } from "../flow/utils" @@ -30,7 +29,8 @@ export default function reduce(state = defaultState, action) { case UPDATE: case REMOVE: case RECEIVE: - // FIXME: Implement select switch for remove + // FIXME: Update state.selected on REMOVE: + // The selected flow may have been removed, we need to select the next one in the view. let storeAction = storeActions[action.cmd]( action.data, makeFilter(state.filter), diff --git a/web/src/js/ducks/utils/store.js b/web/src/js/ducks/utils/store.js index 3252d697..9ea4f02e 100644 --- a/web/src/js/ducks/utils/store.js +++ b/web/src/js/ducks/utils/store.js @@ -13,6 +13,22 @@ const defaultState = { viewIndex: {}, } +/** + * The store reducer can be used as a mixin to another reducer that always returns a + * new { byId, list, listIndex, view, viewIndex } object. The reducer using the store + * usually has to map its action to the matching store action and then call the mixin with that. + * + * Example Usage: + * + * import reduceStore, * as storeActions from "./utils/store" + * + * case EVENTLOG_ADD: + * return { + * ...state, + * ...reduceStore(state, storeActions.add(action.data)) + * } + * + */ export default function reduce(state = defaultState, action) { let { byId, list, listIndex, view, viewIndex } = state |
