From 8e1aa4b371b4c72a99d6c76ebd655c6ae9d5e25a Mon Sep 17 00:00:00 2001 From: Halla Moore Date: Wed, 27 Jul 2016 19:51:13 -0700 Subject: [PATCH] Make sure draft has enough time to save before composer is closed If the composer is closed too quickly, the DatabaseStore doesn't have enough time to trigger the necessary ActionBridge events that will properly save the draft. These events are triggered every 10 ms, so to be safe, we wait 15. --- src/flux/stores/draft-store.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/flux/stores/draft-store.coffee b/src/flux/stores/draft-store.coffee index 9d7125db8..a9a91230a 100644 --- a/src/flux/stores/draft-store.coffee +++ b/src/flux/stores/draft-store.coffee @@ -177,7 +177,9 @@ class DraftStore # handler, so we need to always defer by one tick before re-firing close. Promise.settle(promises).then => @_draftSessions = {} - readyToUnload() + # We have to wait for accumulateAndTrigger() in the DatabaseStore to + # send events to ActionBridge before closing the window. + setTimeout(readyToUnload, 15) # Stop and wait before closing return false