1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00

Fix TypeError thrown on the Snippets page

This commit protects from a TypeError that is consistently
thrown on the Snippets page.
This commit is contained in:
jacobherrington
2018-09-29 23:17:19 -05:00
parent 03b8dbbc44
commit b29c0fe8cb

View File

@@ -27,6 +27,7 @@ class SnippetTab extends React.Component {
handleSnippetSelect (snippet) {
const { currentSnippet } = this.state
if (snippet !== null) {
if (currentSnippet === null || currentSnippet.id !== snippet.id) {
dataApi.fetchSnippet(snippet.id).then(changedSnippet => {
// notify the snippet editor to load the content of the new snippet
@@ -35,6 +36,7 @@ class SnippetTab extends React.Component {
})
}
}
}
onSnippetNameOrPrefixChanged (e, type) {
const newSnippet = Object.assign({}, this.state.currentSnippet)