Przeglądaj źródła

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.
James Allen 10 lat temu
rodzic
commit
a605dae7ba

+ 6 - 3
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