Skip to content

Commit 67e3ada

Browse files
committed
Move default interaction to selector.
1 parent 9b358e1 commit 67e3ada

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

app/src/scenes/Combos/combos.reducer.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,19 @@ export const getComboCount = (state: State) => {
120120
return (count * (count - 1)) / 2;
121121
};
122122

123+
const defaultInteraction = {
124+
interaction: "unknown",
125+
status: "unknown",
126+
description: "",
127+
};
128+
123129
export const getInteraction = (ids: string[]): Interaction => {
124130
return (
125131
find((interaction: Interaction) => {
126132
// If the difference between this substance's IDs array and our target IDs
127133
// array is empty, then this interaction is a match.
128134
return isEmpty(difference(interaction.ids, ids));
129-
})(interactions) || {}
135+
})(interactions) || defaultInteraction
130136
);
131137
};
132138

app/src/scenes/Combos/components/Combo.component.js

+1-10
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,8 @@ type Props = {
2222
secondId: string,
2323
} & StateProps;
2424

25-
const defaultInteraction = {
26-
interaction: "unknown",
27-
status: "unknown",
28-
description: "",
29-
};
30-
3125
const Combo = (props: Props) => {
32-
const { first, second } = props;
33-
const interaction = isEmpty(props.interaction)
34-
? defaultInteraction
35-
: props.interaction;
26+
const { first, second, interaction } = props;
3627

3728
return (
3829
<div>

0 commit comments

Comments
 (0)