From 6320fcccecfa5c46a735934d784a68acf46c1f4a Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Thu, 19 Mar 2015 14:22:22 +0000 Subject: [PATCH] remove underscore from pollSavingStatus the underscore module is not loading in time for some users on MacOS --- .../controllers/SavingNotificationController.coffee | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/services/web/public/coffee/ide/editor/controllers/SavingNotificationController.coffee b/services/web/public/coffee/ide/editor/controllers/SavingNotificationController.coffee index 3629939798..f9c68ca05f 100644 --- a/services/web/public/coffee/ide/editor/controllers/SavingNotificationController.coffee +++ b/services/web/public/coffee/ide/editor/controllers/SavingNotificationController.coffee @@ -13,11 +13,14 @@ define [ $scope.docSavingStatus = {} pollSavedStatus = () -> oldStatus = $scope.docSavingStatus + oldUnsavedCount = $scope.docSavingStatusCount newStatus = {} + newUnsavedCount = 0 for doc_id, doc of Document.openDocs saving = doc.pollSavedStatus() if !saving + newUnsavedCount++ if oldStatus[doc_id]? newStatus[doc_id] = oldStatus[doc_id] newStatus[doc_id].unsavedSeconds += 1 @@ -28,9 +31,12 @@ define [ } # for performance, only update the display if the old or new - # statuses have any unsaved files - if _.size(newStatus) or _.size(oldStatus) + # counts of unsaved files are nonzeror. If both old and new + # unsaved counts are zero then we know we are in a good state + # and don't need to do anything to the UI. + if newUnsavedCount or oldUnsavedCount $scope.docSavingStatus = newStatus + $scope.docSavingStatusCount = newUnsavedCount $scope.$apply() warnAboutUnsavedChanges = () ->