From e2fb33bdc513385e9d71bc5b3d5068f7db9713d7 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Thu, 28 Jun 2018 20:44:57 +0900 Subject: fix but failed --- src/settings/components/form/keymaps-form.jsx | 2 +- src/settings/components/form/properties-form.jsx | 2 +- src/settings/components/form/search-form.jsx | 4 ++-- src/settings/components/index.jsx | 16 +++++++--------- 4 files changed, 11 insertions(+), 13 deletions(-) (limited to 'src/settings/components') diff --git a/src/settings/components/form/keymaps-form.jsx b/src/settings/components/form/keymaps-form.jsx index f0f69cf..dcf65d9 100644 --- a/src/settings/components/form/keymaps-form.jsx +++ b/src/settings/components/form/keymaps-form.jsx @@ -100,7 +100,7 @@ class KeymapsForm extends Component { return; } - let next = Object.assign({}, this.props.value); + let next = { ...this.props.value }; next[e.target.name] = e.target.value; this.props.onChange(next); diff --git a/src/settings/components/form/properties-form.jsx b/src/settings/components/form/properties-form.jsx index 55c8512..ceb79d7 100644 --- a/src/settings/components/form/properties-form.jsx +++ b/src/settings/components/form/properties-form.jsx @@ -44,7 +44,7 @@ class PropertiesForm extends Component { } let name = e.target.name; - let next = Object.assign({}, this.props.value); + let next = { ...this.props.value }; if (e.target.type.toLowerCase() === 'checkbox') { next[name] = e.target.checked; } else if (e.target.type.toLowerCase() === 'number') { diff --git a/src/settings/components/form/search-form.jsx b/src/settings/components/form/search-form.jsx index e85761f..2d5f01b 100644 --- a/src/settings/components/form/search-form.jsx +++ b/src/settings/components/form/search-form.jsx @@ -53,10 +53,10 @@ class SearchForm extends Component { let value = this.props.value; let name = e.target.name; let index = e.target.getAttribute('data-index'); - let next = Object.assign({}, { + let next = { default: value.default, engines: value.engines ? value.engines.slice() : [], - }); + }; if (name === 'name') { next.engines[index][0] = e.target.value; diff --git a/src/settings/components/index.jsx b/src/settings/components/index.jsx index e13bfa1..c479986 100644 --- a/src/settings/components/index.jsx +++ b/src/settings/components/index.jsx @@ -134,7 +134,7 @@ class SettingsComponent extends Component { } validateValue(e) { - let next = Object.assign({}, this.state); + let next = { ...this.state }; next.errors.json = ''; try { @@ -146,18 +146,16 @@ class SettingsComponent extends Component { } bindForm(name, value) { - let next = Object.assign({}, this.state, { - settings: Object.assign({}, this.state.settings, { - form: Object.assign({}, this.state.settings.form) - }) - }); + let next = { ...this.state, + settings: { ...this.state.settings, + form: { ...this.state.settings.form }}}; next.settings.form[name] = value; this.setState(next); this.context.store.dispatch(settingActions.save(next.settings)); } bindValue(e) { - let next = Object.assign({}, this.state); + let next = { ...this.state }; let error = false; next.errors.json = ''; @@ -190,7 +188,7 @@ class SettingsComponent extends Component { let form = settingsValues.formFromJson( this.state.settings.json, KeymapsForm.AllowdOps); - let next = Object.assign({}, this.state); + let next = { ...this.state }; next.settings.form = form; next.settings.source = 'form'; next.errors.json = ''; @@ -201,7 +199,7 @@ class SettingsComponent extends Component { migrateToJson() { let json = settingsValues.jsonFromForm(this.state.settings.form); - let next = Object.assign({}, this.state); + let next = { ...this.state }; next.settings.json = json; next.settings.source = 'json'; next.errors.json = ''; -- cgit v1.2.3