@mindline/sync 1.0.108 → 1.0.109

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindline/sync",
3
- "version": "1.0.108",
3
+ "version": "1.0.109",
4
4
  "description": "sync is a node.js package encapsulating JavaScript classes required for configuring Mindline sync service.",
5
5
  "main": "dist/sync.es.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -933,13 +933,18 @@ export class BatchArray {
933
933
  this.init(config, syncPortalGlobalState, bClearLocalStorage);
934
934
  this.pb_startTS = 0;
935
935
  this.pb_progress = 0;
936
- this.pb_increment = 0;
936
+ this.pb_increment = .25;
937
937
  this.pb_timer = null;
938
938
  this.pb_idle = 0;
939
939
  this.pb_idleMax = 0;
940
940
  this.pb_total = 0;
941
941
  this.milestoneArray = new MilestoneArray(false);
942
942
  }
943
+ clearStoredBatchIds(): void {
944
+ if (storageAvailable()) {
945
+ localStorage.setItem("BatchIdArray", "[]");
946
+ }
947
+ }
943
948
  // populate tenantNodes based on config tenants
944
949
  init(
945
950
  config: SyncConfig | null | undefined,
@@ -1038,6 +1043,7 @@ export class BatchArray {
1038
1043
  this.pb_progress = 100;
1039
1044
  setSyncProgress(this.pb_progress);
1040
1045
  setIdleText(`Complete. [max idle: ${this.pb_idleMax}]`);
1046
+ this.clearStoredBatchIds();
1041
1047
  }
1042
1048
  else {
1043
1049
  // if we've gone 60 seconds without a signalR message, finish the sync
@@ -1258,6 +1264,7 @@ export class BatchArray {
1258
1264
  this.milestoneArray.write(setMilestones);
1259
1265
  connection.stop();
1260
1266
  setConfigSyncResult("nothing to sync");
1267
+ this.clearStoredBatchIds();
1261
1268
  console.log(`Setting config sync result: "nothing to sync"`);
1262
1269
  }
1263
1270
  else {
@@ -1281,6 +1288,7 @@ export class BatchArray {
1281
1288
  this.milestoneArray.write(setMilestones);
1282
1289
  connection.stop();
1283
1290
  setConfigSyncResult("sync complete");
1291
+ this.clearStoredBatchIds();
1284
1292
  console.log(`Setting config sync result: "complete"`);
1285
1293
  }
1286
1294
  // if not, has writing even started?
@@ -2187,7 +2195,9 @@ export async function configsRefresh(instance: IPublicClientApplication, authori
2187
2195
  // console.log("Init Info-----------", currentConfig.id)
2188
2196
  // tag components with workspaceIDs
2189
2197
  ii.tagWithWorkspaces();
2190
- localStorage.setItem("BatchIdArray", "{}");
2198
+ // IMPORTANT:
2199
+ // Do not clear BatchIdArray here. It is used by the UI to restore an in-flight sync
2200
+ // after refresh/re-login. BatchIdArray should be cleared when the sync completes.
2191
2201
  return result;
2192
2202
  } else {
2193
2203
  // workspace not found
@@ -4176,4 +4186,4 @@ export async function readerStats(
4176
4186
  console.log(error.message);
4177
4187
  }
4178
4188
  return result;
4179
- }
4189
+ }