fix(menu-icon): Make sure to only show unread state when unread counts have actually changed

This commit is contained in:
Juan Tejada 2016-11-08 14:05:34 -08:00
parent f558f05d69
commit 2bca307f34
2 changed files with 7 additions and 4 deletions

View file

@ -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) =>

@ -1 +1 @@
Subproject commit 498fa1e48ec5bd925eb722307b93e93639500f0f
Subproject commit d8a1ebfb136ef181bc95ddcb4f455170ae1936d3