diff --git a/components/Editor.js b/components/Editor.js index c0b396e..327de21 100644 --- a/components/Editor.js +++ b/components/Editor.js @@ -85,9 +85,7 @@ class Editor extends React.Component { const storedThemes = getThemes(localStorage) - newState.themes = storedThemes - ? [...storedThemes, ...this.state.themes] - : [...this.state.themes] + newState.themes = [...storedThemes, ...this.state.themes] if (newState.theme) { newState.theme = newState.themes.find(t => t.id === newState.theme) || DEFAULT_THEME @@ -107,7 +105,7 @@ class Editor extends React.Component { newState.language = unescapeHtml(newState.language) } - this.setState(newState) + this.updateState(newState) this.isSafari = window.navigator && diff --git a/components/Themes/index.js b/components/Themes/index.js index b77edf6..0c7af0d 100644 --- a/components/Themes/index.js +++ b/components/Themes/index.js @@ -72,11 +72,6 @@ class Themes extends React.PureComponent { } } - selectHighlight = key => () => - this.setState(({ selectedHighlight }) => ({ - selectedHighlight: selectedHighlight === key ? null : key - })) - updateHighlights = updates => this.setState(({ highlights }) => ({ highlights: { @@ -94,11 +89,10 @@ class Themes extends React.PureComponent { render() { const { themes, theme, isVisible, toggleVisibility } = this.props - const { input } = this.state const highlights = { ...theme.highlights, ...this.state.highlights } - const dropdownValue = isVisible ? { name: input } : { id: theme.id, name: theme.name } + const dropdownValue = isVisible ? { name: '' } : { id: theme.id, name: theme.name } const dropdownList = [ {