diff --git a/browser/lib/Repository.js b/browser/lib/Repository.js index 6a47b101..083f5c5a 100644 --- a/browser/lib/Repository.js +++ b/browser/lib/Repository.js @@ -446,6 +446,7 @@ class Repository { if (note != null) { let json = this.json json.starred.push(noteKey) + json.starred = _.uniq(json.starred) return this.saveJSON(json) } @@ -457,6 +458,7 @@ class Repository { let json = this.json json.starred = json.starred .filter((starredKey) => starredKey !== noteKey) + json.starred = _.uniq(json.starred) return this.saveJSON(json) } diff --git a/browser/main/store.js b/browser/main/store.js index 3eba7c04..3f41ad5c 100644 --- a/browser/main/store.js +++ b/browser/main/store.js @@ -144,6 +144,7 @@ function repositories (state = initialRepositories, action) { let targetNoteIndex = _.findIndex(targetRepo.notes, {key: action.note}) if (targetNoteIndex > -1) { targetRepo.starred.push(action.note) + targetRepo.starred = _.uniq(targetRepo.starred) } else { return state } @@ -159,6 +160,7 @@ function repositories (state = initialRepositories, action) { targetRepo.starred = targetRepo.starred .filter((starredKey) => starredKey !== action.note) + targetRepo.starred = _.uniq(targetRepo.starred) return repos }