From c222fa0c390a62b862f41b873b163389d254e499 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Thu, 29 Sep 2016 13:42:52 -0700 Subject: [PATCH] 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. --- src/components/list-data-source.coffee | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/list-data-source.coffee b/src/components/list-data-source.coffee index b12a0c34d..29fe4bd07 100644 --- a/src/components/list-data-source.coffee +++ b/src/components/list-data-source.coffee @@ -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()")