From ce05e94aeb54485c263d15c1eea2d47f99b9af98 Mon Sep 17 00:00:00 2001 From: Evan Morikawa Date: Sat, 5 Nov 2016 11:37:11 -0700 Subject: [PATCH] fix(unload): safely unload the task queue on quit --- src/flux/stores/task-queue.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/flux/stores/task-queue.coffee b/src/flux/stores/task-queue.coffee index e8d0b7f8d..cf4858142 100644 --- a/src/flux/stores/task-queue.coffee +++ b/src/flux/stores/task-queue.coffee @@ -73,9 +73,14 @@ class TaskQueue @_restoreQueue() + @_savedOnUnload = false NylasEnv.onBeforeUnload((finishUnload) => + if @_savedOnUnload then return true @_saveQueue() - .finally(finishUnload) + .finally(() => + @_savedOnUnload = true + finishUnload() + ) return false )