From da7eac7562abc99e8e0d4ac82543739768f43358 Mon Sep 17 00:00:00 2001 From: Jonathan Belcher Date: Wed, 30 Oct 2019 15:41:21 -0400 Subject: [PATCH] Fix/only run notes loaded when notes loaded (#1680) * Only run notesLoaded when notes are indeed loaded After querying the noteBucket we run notes loaded with an empty notes array. This causes havoc because we rely on notes being null until notes are loaded. This commit adds a check to ensure there is at least one note before running notesLoaded * Add release notes * Update RELEASE-NOTES.txt --- RELEASE-NOTES.txt | 1 + lib/flux/app-state.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index e9c5ee8e5..3e91dfa11 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -13,6 +13,7 @@ - Rework WordPress.com signin to prevent infinite looping and login failures [#1627](https://github.com/Automattic/simplenote-electron/pull/1627) - Update link to release-notes in updater config: CHANGELOG -> RELEASE_NOTES + - Stop showing that there are no notes when initially loading notes from the server. [#1680](https://github.com/Automattic/simplenote-electron/pull/1680) ## [v1.9.1] diff --git a/lib/flux/app-state.js b/lib/flux/app-state.js index eb24d6d5e..2d21df49a 100644 --- a/lib/flux/app-state.js +++ b/lib/flux/app-state.js @@ -266,7 +266,9 @@ export const actionMap = new ActionMap({ cursor.continue(); } else { debug(`noteCount: ${notes.length}`); - dispatch(this.action('notesLoaded', { notes: notes })); + if (notes.length) { + dispatch(this.action('notesLoaded', { notes: notes })); + } } }; });