From 6540d2670c0de831c4cbfe7d49a51a549d20eb2d Mon Sep 17 00:00:00 2001 From: Razvan Moraru Date: Thu, 23 Mar 2017 21:01:49 +0100 Subject: [PATCH] better formatting --- browser/main/Detail/SnippetNoteDetail.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/browser/main/Detail/SnippetNoteDetail.js b/browser/main/Detail/SnippetNoteDetail.js index bb2c4912..11d6b364 100644 --- a/browser/main/Detail/SnippetNoteDetail.js +++ b/browser/main/Detail/SnippetNoteDetail.js @@ -250,19 +250,13 @@ class SnippetNoteDetail extends React.Component { } deleteSnippetByIndex (index) { - this.setState(() => { - const snippets = this.state.note.snippets.slice() - snippets.splice(index, 1) - const note = Object.assign({}, this.state.note, {snippets}) - const snippetIndex = this.state.snippetIndex >= snippets.length - ? snippets.length - 1 - : this.state.snippetIndex - - return { - note, - snippetIndex - } - }, () => { + const snippets = this.state.note.snippets.slice() + snippets.splice(index, 1) + const note = Object.assign({}, this.state.note, {snippets}) + const snippetIndex = this.state.snippetIndex >= snippets.length + ? snippets.length - 1 + : this.state.snippetIndex + this.setState({ note, snippetIndex }, () => { this.save() this.refs['code-' + this.state.snippetIndex].reload() })