From 4bae23fe1f10ee504ec0960776689ce66a63d36a Mon Sep 17 00:00:00 2001 From: Yogesh Bhatt <65986357+ygshbht@users.noreply.github.com> Date: Mon, 23 Oct 2023 17:45:56 +0530 Subject: [PATCH] Update comment src/pages/iou/steps/MoneyRequestAmountForm.js Co-authored-by: abdulrahuman5196 <46707890+abdulrahuman5196@users.noreply.github.com> --- src/pages/iou/steps/MoneyRequestAmountForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/steps/MoneyRequestAmountForm.js b/src/pages/iou/steps/MoneyRequestAmountForm.js index 563399de0acf..8195d860a3c7 100644 --- a/src/pages/iou/steps/MoneyRequestAmountForm.js +++ b/src/pages/iou/steps/MoneyRequestAmountForm.js @@ -137,7 +137,7 @@ function MoneyRequestAmountForm({amount, currency, isEditing, forwardedRef, onCu setFormError(''); } - // setCurrentAmount contains another setState making it error-prone. This solution introducing the hasSelectionBeenSet flag was chosen for its simplicity and lower risk of future errors https://github.com/Expensify/App/issues/23300#issuecomment-1766314724. + // setCurrentAmount contains another setState(setSelection) making it error-prone since it is leading to setSelection being called twice for a single setCurrentAmount call. This solution introducing the hasSelectionBeenSet flag was chosen for its simplicity and lower risk of future errors https://github.com/Expensify/App/issues/23300#issuecomment-1766314724. let hasSelectionBeenSet = false; setCurrentAmount((prevAmount) => {