From fce2434dcdef126a3ab180447e7cb48bc24ec1f9 Mon Sep 17 00:00:00 2001
From: Shin'ya Ueoka <ueokande@i-beam.org>
Date: Tue, 30 Apr 2019 09:15:58 +0900
Subject: Specify default props

---
 src/settings/components/form/BlacklistForm.jsx  |  5 +----
 src/settings/components/form/KeymapsForm.jsx    |  5 +----
 src/settings/components/form/PropertiesForm.jsx | 12 +++++-------
 src/settings/components/form/SearchForm.jsx     |  5 +----
 4 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/src/settings/components/form/BlacklistForm.jsx b/src/settings/components/form/BlacklistForm.jsx
index cee04bd..cf7cffe 100644
--- a/src/settings/components/form/BlacklistForm.jsx
+++ b/src/settings/components/form/BlacklistForm.jsx
@@ -25,10 +25,6 @@ class BlacklistForm extends React.Component {
   }
 
   bindValue(e) {
-    if (!this.props.onChange) {
-      return;
-    }
-
     let name = e.target.name;
     let index = e.target.getAttribute('data-index');
     let next = this.props.value ? this.props.value.slice() : [];
@@ -52,6 +48,7 @@ BlacklistForm.propTypes = {
 
 BlacklistForm.defaultProps = {
   value: [],
+  onChange: () => {},
 };
 
 export default BlacklistForm;
diff --git a/src/settings/components/form/KeymapsForm.jsx b/src/settings/components/form/KeymapsForm.jsx
index 26a22d7..5bb65cb 100644
--- a/src/settings/components/form/KeymapsForm.jsx
+++ b/src/settings/components/form/KeymapsForm.jsx
@@ -30,10 +30,6 @@ class KeymapsForm extends React.Component {
   }
 
   bindValue(e) {
-    if (!this.props.onChange) {
-      return;
-    }
-
     let next = { ...this.props.value };
     next[e.target.name] = e.target.value;
 
@@ -48,6 +44,7 @@ KeymapsForm.propTypes = {
 
 KeymapsForm.defaultProps = {
   value: {},
+  onChange: () => {},
 };
 
 export default KeymapsForm;
diff --git a/src/settings/components/form/PropertiesForm.jsx b/src/settings/components/form/PropertiesForm.jsx
index 9143a7a..0014899 100644
--- a/src/settings/components/form/PropertiesForm.jsx
+++ b/src/settings/components/form/PropertiesForm.jsx
@@ -7,9 +7,6 @@ class PropertiesForm extends React.Component {
   render() {
     let types = this.props.types;
     let value = this.props.value;
-    if (!value) {
-      value = {};
-    }
 
     return <div className='form-properties-form'>
       {
@@ -40,10 +37,6 @@ class PropertiesForm extends React.Component {
   }
 
   bindValue(e) {
-    if (!this.props.onChange) {
-      return;
-    }
-
     let name = e.target.name;
     let next = { ...this.props.value };
     if (e.target.type.toLowerCase() === 'checkbox') {
@@ -63,4 +56,9 @@ PropertiesForm.propTypes = {
   onChange: PropTypes.func,
 };
 
+PropertiesForm.defaultProps = {
+  value: {},
+  onChange: () => {},
+};
+
 export default PropertiesForm;
diff --git a/src/settings/components/form/SearchForm.jsx b/src/settings/components/form/SearchForm.jsx
index 2e070fc..d2f2d48 100644
--- a/src/settings/components/form/SearchForm.jsx
+++ b/src/settings/components/form/SearchForm.jsx
@@ -44,10 +44,6 @@ class SearchForm extends React.Component {
   }
 
   bindValue(e) {
-    if (!this.props.onChange) {
-      return;
-    }
-
     let value = this.props.value;
     let name = e.target.name;
     let index = e.target.getAttribute('data-index');
@@ -83,6 +79,7 @@ SearchForm.propTypes = {
 
 SearchForm.defaultProps = {
   value: { default: '', engines: []},
+  onChange: () => {},
 };
 
 export default SearchForm;
-- 
cgit v1.2.3