fix(data-source): Wait until the next cycle to cleanup

Fixes a crash when switching to the thread list from the draft list, where there are very briefly zero observers.
This commit is contained in:
Ben Gotow 2016-09-29 13:42:52 -07:00
parent 1e9d1dff07
commit c222fa0c39

View file

@ -26,9 +26,10 @@ class ListDataSource
return =>
@_emitter.removeListener('trigger', eventHandler)
if @_emitter.listenerCount('trigger') is 0
@_cleanedup = true
@cleanup()
process.nextTick =>
if @_emitter.listenerCount('trigger') is 0
@_cleanedup = true
@cleanup()
loaded: ->
throw new Error("ListDataSource base class does not implement loaded()")