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.
This commit is contained in:
Halla Moore 2016-07-27 19:51:13 -07:00
parent a728722f0f
commit 8e1aa4b371

View file

@ -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