From 05c38ec575760ff54e60f25570391ab2dd51fb3b Mon Sep 17 00:00:00 2001 From: hackrush Date: Mon, 7 Aug 2017 21:45:53 +0530 Subject: [PATCH] Using setState in formFieldPrice --- CHANGELOG.md | 1 + ui/js/component/formFieldPrice/view.jsx | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c4dd3b55..2db7d593f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Web UI version numbers should always match the corresponding version of LBRY App * Tiles will no longer be blurry on hover (Windows only bug) * Removed placeholder values from price selection form fields, which was causing confusion that these were real values (#426) * Fixed showing "other currency" help tip in publish form, which was caused due to not "setting" state for price + * Now using setState in formFieldPrice * ### Deprecated diff --git a/ui/js/component/formFieldPrice/view.jsx b/ui/js/component/formFieldPrice/view.jsx index 5b1387aee..ed85a05b9 100644 --- a/ui/js/component/formFieldPrice/view.jsx +++ b/ui/js/component/formFieldPrice/view.jsx @@ -14,21 +14,23 @@ class FormFieldPrice extends React.PureComponent { }; } - dispatchChange() { + handleChange(newValues) { + const newState = Object.assign({}, this.state, newValues); + this.setState(newState); this.props.onChange({ - amount: this.state.amount, - currency: this.state.currency, + amount: newState.amount, + currency: newState.currency, }); } handleFeeAmountChange(event) { - this.state.amount = event.target.value ? Number(event.target.value) : null; - this.dispatchChange(); + this.handleChange({ + amount: event.target.value ? Number(event.target.value) : null, + }); } handleFeeCurrencyChange(event) { - this.state.currency = event.target.value; - this.dispatchChange(); + this.handleChange({ currency: event.target.value }); } render() { -- 2.45.2