diff --git a/package.json b/package.json index cfcc1860e..5f5df0126 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "bugs": { "url": "https://github.com/nylas/edgehill/issues" }, - "electronVersion": "0.28.1", + "electronVersion": "0.29.2", "dependencies": { "asar": "^0.5.0", "6to5-core": "^3.5", diff --git a/src/flux/stores/database-store.coffee b/src/flux/stores/database-store.coffee index 5eb381980..e4b8b08fc 100644 --- a/src/flux/stores/database-store.coffee +++ b/src/flux/stores/database-store.coffee @@ -387,10 +387,10 @@ class DatabaseStore extends NylasStore # Avoid trying to write too many objects a time - sqlite can only handle # value sets `(?,?)...` of less than SQLITE_MAX_COMPOUND_SELECT (500), # and we don't know ahead of time whether we'll hit that or not. - if models.length > 100 + if models.length > 50 return Promise.all([ - @_writeModels(models[0..99]) - @_writeModels(models[100..models.length]) + @_writeModels(models[0..49]) + @_writeModels(models[50..models.length]) ]) klass = models[0].constructor diff --git a/src/flux/stores/unread-count-store.coffee b/src/flux/stores/unread-count-store.coffee index cdb22c8e5..587c8bf8c 100644 --- a/src/flux/stores/unread-count-store.coffee +++ b/src/flux/stores/unread-count-store.coffee @@ -29,7 +29,7 @@ UnreadCountStore = Reflux.createStore @_onDataChanged() _onDataChanged: (change) -> - return app.dock?.setBadge?("") unless NamespaceStore.current() + return @_setBadge("") unless NamespaceStore.current() if change && change.objectClass is Thread.name @_fetchCountDebounced ?= _.debounce(@_fetchCount, 5000) @@ -46,14 +46,21 @@ UnreadCountStore = Reflux.createStore ]).then (count) => return if @_count is count @_count = count - - if count > 999 - app.dock?.setBadge?("999+") - else if count > 0 - app.dock?.setBadge?("#{count}") - else - app.dock?.setBadge?("") - + @_updateBadgeForCount(count) @trigger() + .catch (err) => + console.warn("Failed to fetch unread count: #{err}") + + _updateBadgeForCount: (count) -> + return unless atom.isMainWindow() + if count > 999 + @_setBadge("999+") + else if count > 0 + @_setBadge("#{count}") + else + @_setBadge("") + + _setBadge: (val) -> + app.dock?.setBadge?(val) module.exports = UnreadCountStore