From 2bca307f3471057d3d980897eec96ea3911952da Mon Sep 17 00:00:00 2001 From: Juan Tejada Date: Tue, 8 Nov 2016 14:05:34 -0800 Subject: [PATCH] fix(menu-icon): Make sure to only show unread state when unread counts have actually changed --- src/flux/stores/thread-counts-store.coffee | 9 ++++++--- src/pro | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/flux/stores/thread-counts-store.coffee b/src/flux/stores/thread-counts-store.coffee index e311d5378..c0ee994a9 100644 --- a/src/flux/stores/thread-counts-store.coffee +++ b/src/flux/stores/thread-counts-store.coffee @@ -1,4 +1,3 @@ -Reflux = require 'reflux' _ = require 'underscore' NylasStore = require 'nylas-store' DatabaseStore = require('./database-store').default @@ -86,11 +85,11 @@ class ThreadCountsStore extends NylasStore _onCountsChanged: => DatabaseStore._query(ReadCountsQuery()).then (results) => - @_counts = {} + nextCounts = {} foundNegative = false for {category_id, unread, total} in results - @_counts[category_id] = {unread, total} + nextCounts[category_id] = {unread, total} if unread < 0 or total < 0 foundNegative = true @@ -99,6 +98,10 @@ class ThreadCountsStore extends NylasStore @reset() return + if _.isEqual(nextCounts, @_counts) + return + + @_counts = nextCounts @trigger() unreadCountForCategoryId: (catId) => diff --git a/src/pro b/src/pro index 498fa1e48..d8a1ebfb1 160000 --- a/src/pro +++ b/src/pro @@ -1 +1 @@ -Subproject commit 498fa1e48ec5bd925eb722307b93e93639500f0f +Subproject commit d8a1ebfb136ef181bc95ddcb4f455170ae1936d3