From a605dae7bafe1f8a95e7c64dda832f0358e9fe92 Mon Sep 17 00:00:00 2001 From: James Allen Date: Fri, 27 May 2016 14:08:46 +0100 Subject: [PATCH] Don't show saving just because of pending ops When typing continuously, there is always a pending op present. The only time we're not saving is if the inflight op isn't changing. So long as this has changed, it means the previous one has been processed. --- services/web/public/coffee/ide/editor/Document.coffee | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/services/web/public/coffee/ide/editor/Document.coffee b/services/web/public/coffee/ide/editor/Document.coffee index eb8843629c..4465d2e2fe 100644 --- a/services/web/public/coffee/ide/editor/Document.coffee +++ b/services/web/public/coffee/ide/editor/Document.coffee @@ -146,12 +146,15 @@ define [ if !inflightOp? and !pendingOp? # there's nothing going on saved = true - else if inflightOp == @oldInflightOp - saved = false - else if pendingOp? + sl_console.log "[pollSavedStatus] no inflight or pending ops" + else if inflightOp? and inflightOp == @oldInflightOp + # The same inflight op has been sitting unacked since we + # last checked. saved = false + sl_console.log "[pollSavedStatus] inflight op is same as before" else saved = true + sl_console.log "[pollSavedStatus] assuming saved (inflightOp?: #{inflightOp?}, pendingOp?: #{pendingOp?})" @oldInflightOp = inflightOp return saved