Skip to content

Commit 6213732

Browse files
committed
fix: ingredient unit not updated in some cases
1 parent 13b72c3 commit 6213732

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/screens/wizard/IngredientFromField.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ export const IngredientFormField = React.memo(function IngredientFormField(props
6565
});
6666
};
6767

68+
const onUnitChange = (newUnit: string) => {
69+
setUnit(newUnit);
70+
invokeIngredientUpdate(ingredientQuery, amount, newUnit);
71+
};
72+
6873
const onAmountChange = (text: string) => {
6974
text = text.replace(',', '.');
7075
setAmount(text);
@@ -102,7 +107,7 @@ export const IngredientFormField = React.memo(function IngredientFormField(props
102107
label={t('screens.editRecipe.unit')}
103108
value={unit}
104109
options={availableUnits.map((availableUnit, index) => ({key: index.toString(), value: availableUnit}))}
105-
onValueChanged={(selectedOption) => setUnit(selectedOption.value)}
110+
onValueChanged={(selectedOption) => onUnitChange(selectedOption.value)}
106111
/>
107112
</View>
108113
<Spacer height={5} />

0 commit comments

Comments
 (0)