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:
@@ -27,12 +27,14 @@ class SnippetTab extends React.Component {
|
|||||||
|
|
||||||
handleSnippetSelect (snippet) {
|
handleSnippetSelect (snippet) {
|
||||||
const { currentSnippet } = this.state
|
const { currentSnippet } = this.state
|
||||||
if (currentSnippet === null || currentSnippet.id !== snippet.id) {
|
if (snippet !== null) {
|
||||||
dataApi.fetchSnippet(snippet.id).then(changedSnippet => {
|
if (currentSnippet === null || currentSnippet.id !== snippet.id) {
|
||||||
// notify the snippet editor to load the content of the new snippet
|
dataApi.fetchSnippet(snippet.id).then(changedSnippet => {
|
||||||
this.snippetEditor.onSnippetChanged(changedSnippet)
|
// notify the snippet editor to load the content of the new snippet
|
||||||
this.setState({currentSnippet: changedSnippet})
|
this.snippetEditor.onSnippetChanged(changedSnippet)
|
||||||
})
|
this.setState({currentSnippet: changedSnippet})
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user