http-request-manager 18.13.15 → 18.13.16

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.
@@ -1209,12 +1209,49 @@ class QueryParamsTrackerService {
1209
1209
  return;
1210
1210
  }
1211
1211
  const syncState = this.localStorageManager.getPersistedStoreSync(TRACKER_STORE_NAME);
1212
- if (!this.isTrackerState(syncState)) {
1212
+ if (this.isTrackerState(syncState)) {
1213
+ this.state = QueryTrackerStateModel.adapt(syncState);
1214
+ this.cleanupExpiredEntries();
1213
1215
  return;
1214
1216
  }
1215
- this.state = QueryTrackerStateModel.adapt(syncState);
1217
+ const fallbackState = this.getTrackerStateFromRawStorage();
1218
+ if (!this.isTrackerState(fallbackState)) {
1219
+ return;
1220
+ }
1221
+ this.state = QueryTrackerStateModel.adapt(fallbackState);
1216
1222
  this.cleanupExpiredEntries();
1217
1223
  }
1224
+ getTrackerStateFromRawStorage() {
1225
+ const rawSources = [
1226
+ this.safeParseRawStorage(localStorage.getItem('storage')),
1227
+ this.safeParseRawStorage(sessionStorage.getItem('storage')),
1228
+ ];
1229
+ for (const source of rawSources) {
1230
+ if (!Array.isArray(source)) {
1231
+ continue;
1232
+ }
1233
+ for (const entry of source) {
1234
+ if (this.isTrackerState(entry?.data)) {
1235
+ return entry.data;
1236
+ }
1237
+ if (this.isTrackerState(entry)) {
1238
+ return entry;
1239
+ }
1240
+ }
1241
+ }
1242
+ return null;
1243
+ }
1244
+ safeParseRawStorage(value) {
1245
+ if (!value) {
1246
+ return null;
1247
+ }
1248
+ try {
1249
+ return JSON.parse(value);
1250
+ }
1251
+ catch {
1252
+ return null;
1253
+ }
1254
+ }
1218
1255
  persistState() {
1219
1256
  this.localStorageManager.storeExists$(TRACKER_STORE_NAME)
1220
1257
  .pipe(take(1))