From 84ac23935bb2b998646aa8da42a9331e18d20aed Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Tue, 14 Dec 2021 18:43:56 +0530 Subject: [PATCH 1/3] Persist IOU currency selection --- src/pages/iou/IOUCurrencySelection.js | 2 +- src/pages/iou/IOUModal.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pages/iou/IOUCurrencySelection.js b/src/pages/iou/IOUCurrencySelection.js index d2a85cc4ea8aa..0d47e11f4f736 100644 --- a/src/pages/iou/IOUCurrencySelection.js +++ b/src/pages/iou/IOUCurrencySelection.js @@ -75,7 +75,7 @@ class IOUCurrencySelection extends Component { this.state = { searchValue: '', currencyData: currencyOptions, - toggledCurrencyCode: this.props.myPersonalDetails.localCurrencyCode, + toggledCurrencyCode: this.props.iou.selectedCurrencyCode || this.props.myPersonalDetails.localCurrencyCode, }; this.getCurrencyOptions = this.getCurrencyOptions.bind(this); this.toggleOption = this.toggleOption.bind(this); diff --git a/src/pages/iou/IOUModal.js b/src/pages/iou/IOUModal.js index 5c1eb004a4fd8..afe1a3058ff58 100755 --- a/src/pages/iou/IOUModal.js +++ b/src/pages/iou/IOUModal.js @@ -145,6 +145,9 @@ class IOUModal extends Component { componentDidMount() { PersonalDetails.fetchLocalCurrency(); + if (this.props.iou.selectedCurrencyCode) { + return; + } IOU.setIOUSelectedCurrency(this.props.myPersonalDetails.localCurrencyCode); } @@ -161,8 +164,7 @@ class IOUModal extends Component { this.setState({currentStepIndex: 0}); } - if (prevProps.iou.selectedCurrencyCode - !== this.props.iou.selectedCurrencyCode) { + if (prevProps.iou.selectedCurrencyCode !== this.props.iou.selectedCurrencyCode) { IOU.setIOUSelectedCurrency(this.props.iou.selectedCurrencyCode); } } From ea1e2727a3842c6017049211a6cee24666ab43df Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Wed, 15 Dec 2021 12:13:05 +0530 Subject: [PATCH 2/3] Remove early return --- src/pages/iou/IOUModal.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/iou/IOUModal.js b/src/pages/iou/IOUModal.js index afe1a3058ff58..68a88e1107215 100755 --- a/src/pages/iou/IOUModal.js +++ b/src/pages/iou/IOUModal.js @@ -145,10 +145,9 @@ class IOUModal extends Component { componentDidMount() { PersonalDetails.fetchLocalCurrency(); - if (this.props.iou.selectedCurrencyCode) { - return; + if (!this.props.iou.selectedCurrencyCode) { + IOU.setIOUSelectedCurrency(this.props.myPersonalDetails.localCurrencyCode); } - IOU.setIOUSelectedCurrency(this.props.myPersonalDetails.localCurrencyCode); } componentDidUpdate(prevProps) { From 8994349b86818239464eff3925373e6629009a42 Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Fri, 17 Dec 2021 12:45:34 +0530 Subject: [PATCH 3/3] Revert to use default currency --- src/pages/iou/IOUModal.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/iou/IOUModal.js b/src/pages/iou/IOUModal.js index 68a88e1107215..175a30c595fc3 100755 --- a/src/pages/iou/IOUModal.js +++ b/src/pages/iou/IOUModal.js @@ -145,9 +145,7 @@ class IOUModal extends Component { componentDidMount() { PersonalDetails.fetchLocalCurrency(); - if (!this.props.iou.selectedCurrencyCode) { - IOU.setIOUSelectedCurrency(this.props.myPersonalDetails.localCurrencyCode); - } + IOU.setIOUSelectedCurrency(this.props.myPersonalDetails.localCurrencyCode); } componentDidUpdate(prevProps) {