Skip to content

Commit

Permalink
[Mobile] Fix "Category budget has been updated to ..." notification e…
Browse files Browse the repository at this point in the history
…ven when the budget was not updated (#4200)

* Fix FocusableAmountInput's onUpdate to only fire when amount was updated

* Release notes
  • Loading branch information
joel-jeremy authored Jan 20, 2025
1 parent 6cbf3e3 commit dd2b0a8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,12 @@ const AmountInput = memo(function AmountInput({
};

const onUpdate = (value: string) => {
props.onUpdate?.(value);
const originalAmount = Math.abs(props.value);
const amount = applyText();
props.onUpdateAmount?.(amount);
if (amount !== originalAmount) {
props.onUpdate?.(value);
props.onUpdateAmount?.(amount);
}
};

const onBlur: HTMLProps<HTMLInputElement>['onBlur'] = e => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -584,11 +584,9 @@ const TransactionEditInner = memo(function TransactionEditInner({
value => {
if (transaction.amount !== value) {
onUpdateInner(transaction, 'amount', value.toString());
} else {
onClearActiveEdit();
}
},
[onClearActiveEdit, onUpdateInner, transaction],
[onUpdateInner, transaction],
);

const onEditFieldInner = useCallback(
Expand Down Expand Up @@ -788,6 +786,7 @@ const TransactionEditInner = memo(function TransactionEditInner({
zeroSign="-"
focused={totalAmountFocused}
onFocus={onTotalAmountEdit}
onBlur={onClearActiveEdit}
onUpdateAmount={onTotalAmountUpdate}
focusedStyle={{
width: 'auto',
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/4200.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [joel-jeremy]
---

Fix FocusableAmountInput's onUpdate to only fire when amount was updated

0 comments on commit dd2b0a8

Please sign in to comment.