Skip to content

Commit f885734

Browse files
committed
Refactor interaction lookup.
1 parent 8151263 commit f885734

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ const defaultInteraction = {
127127
};
128128

129129
export const getInteraction = (ids: string[]): Interaction => {
130-
return (
131-
find((interaction: Interaction) => {
132-
// If the difference between this substance's IDs array and our target IDs
133-
// array is empty, then this interaction is a match.
134-
return isEmpty(difference(interaction.ids, ids));
135-
})(interactions) || defaultInteraction
136-
);
130+
const interaction = find((interaction: Interaction) => {
131+
// If the difference between this substance's IDs array and our target IDs
132+
// array is empty, then this interaction is a match.
133+
return isEmpty(difference(interaction.ids, ids));
134+
})(interactions);
135+
136+
return isEmpty(interaction) ? { ...defaultInteraction, ids } : interaction;
137137
};
138138

139139
type Combo = [string, string];

0 commit comments

Comments
 (0)