logService.info(`GlobalState: Skipped updating ${key} in storage. It is not registered to sync.`);
logService.info(`GlobalState: Skipped adding ${key} in local storage as it is not registered.`);
continue;
}
if(storageKey.version!==remoteValue.version){
logService.info(`GlobalState: Skipped updating ${key} in storage. Local version '${storageKey.version}' and remote version '${remoteValue.version} are not same.`);
logService.info(`GlobalState: Skipped adding ${key} in local storage. Local version '${storageKey.version}' and remote version '${remoteValue.version} are not same.`);
continue;
}
constlocalValue=localStorage[key];
...
...
@@ -60,11 +63,11 @@ export function merge(localStorage: IStringDictionary<IStorageValue>, remoteStor
logService.info(`GlobalState: Skipped updating ${key} in storage. It is not registered to sync.`);
logService.info(`GlobalState: Skipped updating ${key} in local storage as is not registered.`);
continue;
}
if(storageKey.version!==remoteValue.version){
logService.info(`GlobalState: Skipped updating ${key} in storage. Local version '${storageKey.version}' and remote version '${remoteValue.version} are not same.`);
logService.info(`GlobalState: Skipped updating ${key} in local storage. Local version '${storageKey.version}' and remote version '${remoteValue.version} are not same.`);
continue;
}
constlocalValue=localStorage[key];
...
...
@@ -78,7 +81,7 @@ export function merge(localStorage: IStringDictionary<IStorageValue>, remoteStor
logService.info(`GlobalState: Skipped updating ${key} in storage. It is not registered to sync.`);
logService.info(`GlobalState: Skipped removing ${key} in local storage. It is not registered to sync.`);
continue;
}
local.removed.push(key);
...
...
@@ -99,6 +102,7 @@ export function merge(localStorage: IStringDictionary<IStorageValue>, remoteStor
constremoteValue=remote[key];
constlocalValue=localStorage[key];
if(localValue.version<remoteValue.version){
logService.info(`GlobalState: Skipped updating ${key} in remote storage. Local version '${localValue.version}' and remote version '${remoteValue.version} are not same.`);
continue;
}
remote[key]=localValue;
...
...
@@ -109,11 +113,21 @@ export function merge(localStorage: IStringDictionary<IStorageValue>, remoteStor
// do not remove from remote if storage key is not found
if(!storageKey){
logService.info(`GlobalState: Skipped removing ${key} in remote storage. It is not registered to sync.`);
continue;
}
constremoteValue=remote[key];
// do not remove from remote if local data version is old
if(storageKey.version<remoteValue.version){
logService.info(`GlobalState: Skipped updating ${key} in remote storage. Local version '${storageKey.version}' and remote version '${remoteValue.version} are not same.`);