Fixed state handling issue when deleting note

pull/41/head
Laurent Cozic 2017-10-24 18:17:49 +00:00
parent 218405503d
commit 3cb52a4107
3 changed files with 3 additions and 6 deletions

View File

@ -161,7 +161,7 @@ class AppGui {
let note = noteList.currentItem; let note = noteList.currentItem;
this.store_.dispatch({ this.store_.dispatch({
type: 'NOTES_SELECT', type: 'NOTES_SELECT',
noteId: note ? note.id : 0, noteId: note ? note.id : null,
}); });
}); });
this.rootWidget_.connect(noteList, (state) => { this.rootWidget_.connect(noteList, (state) => {

View File

@ -594,10 +594,6 @@ class Application {
if (!currentFolder) currentFolder = await Folder.defaultFolder(); if (!currentFolder) currentFolder = await Folder.defaultFolder();
Setting.setValue('activeFolderId', currentFolder ? currentFolder.id : ''); Setting.setValue('activeFolderId', currentFolder ? currentFolder.id : '');
setInterval(() => {
this.logger().debug(Setting.value('activeFolderId'), this.store().getState().settings.activeFolderId, this.store().getState().selectedFolderId);
}, 1000);
// If we have some arguments left at this point, it's a command // If we have some arguments left at this point, it's a command
// so execute it. // so execute it.
if (argv.length) { if (argv.length) {

View File

@ -25,8 +25,9 @@ class NoteWidget extends TextWidget {
async onWillRender() { async onWillRender() {
if (!this.note_ && this.noteId_) { if (!this.note_ && this.noteId_) {
this.note_ = await Note.load(this.noteId_); this.note_ = await Note.load(this.noteId_);
this.text = this.note_.title + "\n\n" + this.note_.body;
} }
this.text = this.note_ ? this.note_.title + "\n\n" + this.note_.body : '';
} }
} }