From f5f53f17d6e2d76241633bd239773fd19d0b17a3 Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Wed, 1 May 2019 11:06:18 -0700 Subject: [PATCH] fix bug that occurs when escape is hit on dropdowns --- components/Editor.js | 4 +++- components/Themes/index.js | 14 ++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/components/Editor.js b/components/Editor.js index 02cd3cd..49dec64 100644 --- a/components/Editor.js +++ b/components/Editor.js @@ -257,7 +257,9 @@ class Editor extends React.Component { } updateLanguage(language) { - this.updateSetting('language', language.mime || language.mode) + if (language) { + this.updateSetting('language', language.mime || language.mode) + } } updateBackground({ photographer, ...changes } = {}) { diff --git a/components/Themes/index.js b/components/Themes/index.js index 334f3d3..61cd7df 100644 --- a/components/Themes/index.js +++ b/components/Themes/index.js @@ -67,12 +67,14 @@ class Themes extends React.PureComponent { } handleThemeSelected = theme => { - const { toggleVisibility, update } = this.props - if (theme.id === 'create') { - toggleVisibility() - this.dropdown.current.closeMenu() - } else { - update(theme.id) + if (theme) { + const { toggleVisibility, update } = this.props + if (theme.id === 'create') { + toggleVisibility() + this.dropdown.current.closeMenu() + } else { + update(theme.id) + } } }