From 9923dacde7019511bca47fe4b85bb2e471385b04 Mon Sep 17 00:00:00 2001 From: Mo Bitar Date: Fri, 3 Nov 2017 18:34:11 -0500 Subject: [PATCH] Comment regarding alternate uuids during sign in --- app/assets/javascripts/app/services/syncManager.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/app/services/syncManager.js b/app/assets/javascripts/app/services/syncManager.js index 23a333679..d5c5cf95a 100644 --- a/app/assets/javascripts/app/services/syncManager.js +++ b/app/assets/javascripts/app/services/syncManager.js @@ -99,8 +99,15 @@ class SyncManager { var item = originalItems[index]; index++; - // false => dont remove original. We want to keep both copies - this.modelManager.alternateUUIDForItem(item, alternateNextItem, false); + + // alternateUUIDForItem last param is a boolean that controls whether the original item + // should be removed locally after new item is created. We set this to true, since during sign in, + // all item ids are alternated, and we only want one final copy of the entire data set. + // Passing false can be desired sometimes, when for example the app has signed out the user, + // but for some reason retained their data (This happens in Firefox when using private mode). + // In this case, we should pass false so that both copies are kept. However, it's difficult to + // detect when the app has entered this state. We will just use true to remove original items for now. + this.modelManager.alternateUUIDForItem(item, alternateNextItem, true); } alternateNextItem();