Bug 1482868 - Prevent empty values only when submitting network location;r=daisuke
authorJulian Descottes <jdescottes@mozilla.com>
Tue, 28 Aug 2018 13:42:43 +0000
changeset 491321 40fb4831d16ca04337bd517f4848592362c1170c
parent 491320 88fa28d336fa5ec92bc272682fb4ee9fe85c7487
child 491322 400d4a90fe04ed684626d700ca3fc104835d82df
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaisuke
bugs1482868
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1482868 - Prevent empty values only when submitting network location;r=daisuke Depends on D3222 Differential Revision: https://phabricator.services.mozilla.com/D3224
devtools/client/aboutdebugging-new/src/components/ConnectPage.js
--- a/devtools/client/aboutdebugging-new/src/components/ConnectPage.js
+++ b/devtools/client/aboutdebugging-new/src/components/ConnectPage.js
@@ -137,32 +137,33 @@ class ConnectPage extends PureComponent 
         {
           className: "connect-page__network__separator"
         }
       ),
       dom.form(
         {
           className: "connect-page__network-form",
           onSubmit: (e) => {
-            addNetworkLocation(this.state.locationInputValue);
-            this.setState({ locationInputValue: "" });
+            const locationInputValue = this.state.locationInputValue;
+            if (locationInputValue) {
+              addNetworkLocation(locationInputValue);
+              this.setState({ locationInputValue: "" });
+            }
             e.preventDefault();
           }
         },
         dom.span({}, "Host:port"),
         dom.input({
           className: "connect-page__network-form__input",
           placeholder: "localhost:6080",
           type: "text",
           value: this.state.locationInputValue,
           onChange: (e) => {
             const locationInputValue = e.target.value;
-            if (locationInputValue) {
-              this.setState({ locationInputValue });
-            }
+            this.setState({ locationInputValue });
           }
         }),
         dom.button({
           className: "aboutdebugging-button"
         }, "Add")
       )
     );
   }