mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 18:32:20 +08:00
_version was conflicting with superclass property
This commit is contained in:
parent
2380e1eefa
commit
c2ebc4cb32
1 changed files with 12 additions and 7 deletions
|
@ -11,7 +11,7 @@ class SearchSubscription extends MutableQuerySubscription
|
|||
constructor: (@_terms, @_accountIds) ->
|
||||
super(null, {asResultSet: true})
|
||||
|
||||
@_version = 0
|
||||
@_termsVersion = 0
|
||||
_.defer => @retrievePage(0)
|
||||
|
||||
terms: =>
|
||||
|
@ -19,7 +19,7 @@ class SearchSubscription extends MutableQuerySubscription
|
|||
|
||||
setTerms: (terms) =>
|
||||
@_terms = terms
|
||||
@_version += 1
|
||||
@_termsVersion += 1
|
||||
@retrievePage(0)
|
||||
|
||||
replaceRange: (range) =>
|
||||
|
@ -28,7 +28,8 @@ class SearchSubscription extends MutableQuerySubscription
|
|||
# Accessing Data
|
||||
|
||||
retrievePage: (idx) =>
|
||||
version = @_version += 1
|
||||
termsVersion = @_termsVersion += 1
|
||||
resultCount = 0
|
||||
resultIds = []
|
||||
|
||||
@_accountIds.forEach (aid) =>
|
||||
|
@ -39,9 +40,13 @@ class SearchSubscription extends MutableQuerySubscription
|
|||
json: true
|
||||
returnsModel: true
|
||||
.then (threads) =>
|
||||
return unless @_version is version
|
||||
|
||||
return unless @_termsVersion is termsVersion
|
||||
resultCount += 1
|
||||
resultIds = resultIds.concat _.pluck(threads, 'id')
|
||||
|
||||
# Don't emit a "result" until we have at least one thread to display.
|
||||
# Otherwise it will show "No Results Found"
|
||||
if resultIds.length > 0 or resultCount is @_accountIds.length
|
||||
query = DatabaseStore.findAll(Thread).where(id: resultIds).order(Thread.attributes.lastMessageReceivedTimestamp.descending())
|
||||
@replaceQuery(query)
|
||||
|
||||
|
|
Loading…
Reference in a new issue