From 3ed861369efac5627be6f02b552a40ebfa1e8972 Mon Sep 17 00:00:00 2001 From: uwap Date: Fri, 19 Jan 2018 21:57:20 +0100 Subject: [PATCH] Fix build --- src/components/UiItemList/UiItem.js | 5 +++-- src/utils/state.js | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 src/utils/state.js diff --git a/src/components/UiItemList/UiItem.js b/src/components/UiItemList/UiItem.js index 182017c..054308f 100644 --- a/src/components/UiItemList/UiItem.js +++ b/src/components/UiItemList/UiItem.js @@ -14,6 +14,7 @@ import { MenuItem } from "material-ui/Menu"; import Button from "material-ui/Button"; import keyOf from "utils/keyOf"; +import { getInternals, getActuals } from "utils/state"; type UiItemProps = { item: I, @@ -45,8 +46,8 @@ export default class UiItem extends React.Component> { typeof this.props.item.enableCondition == "function") { const enableCondition = this.props.item.enableCondition; const state = this.props.state; - const internals = _.mapValues(state, (x) => x.internal); - const actuals = _.mapValues(state, (x) => x.actual); + const internals = getInternals(state); + const actuals = getActuals(state); return enableCondition(internals, actuals, state); } else { return true; diff --git a/src/utils/state.js b/src/utils/state.js new file mode 100644 index 0000000..94fcd48 --- /dev/null +++ b/src/utils/state.js @@ -0,0 +1,8 @@ +// @flow +import _ from "lodash"; + +export const getInternals = (state: State): Map => + _.mapValues(state, (x) => x.internal || x.actual); + +export const getActuals = (state: State): Map => + _.mapValues(state, (x) => x.actual);