@hkdigital/lib-sveltekit 0.1.97 → 0.1.99
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.
@@ -326,7 +326,7 @@ export default class IndexedDbCache {
|
|
326
326
|
// Track concurrent reads per key
|
327
327
|
const current = concurrentReadsByKey.get(key) || 0;
|
328
328
|
concurrentReadsByKey.set(key, current + 1);
|
329
|
-
console.log(`Concurrent reads for ${key}: ${current + 1}`);
|
329
|
+
// console.log(`Concurrent reads for ${key}: ${current + 1}`);
|
330
330
|
|
331
331
|
try {
|
332
332
|
const db = await this.dbPromise;
|
@@ -357,15 +357,15 @@ export default class IndexedDbCache {
|
|
357
357
|
}
|
358
358
|
|
359
359
|
// Update access timestamp (but don't block)
|
360
|
-
this._updateAccessTime(key).catch((err) => {
|
361
|
-
|
362
|
-
});
|
360
|
+
// this._updateAccessTime(key).catch((err) => {
|
361
|
+
// console.error('Failed to update access time:', err);
|
362
|
+
// });
|
363
363
|
|
364
364
|
// Check if from a different cache version
|
365
365
|
if (entry.cacheVersion !== this.cacheVersion) {
|
366
|
-
|
367
|
-
|
368
|
-
|
366
|
+
console.log(
|
367
|
+
`Migrating entry ${key} from version ${entry.cacheVersion} to ${this.cacheVersion}`
|
368
|
+
);
|
369
369
|
|
370
370
|
// Clone the entry for migration
|
371
371
|
const migratedEntry = {
|
@@ -386,10 +386,17 @@ export default class IndexedDbCache {
|
|
386
386
|
try {
|
387
387
|
let responseHeaders = new Headers(entry.headers);
|
388
388
|
|
389
|
+
let responseBody = entry.body;
|
390
|
+
|
391
|
+
if (responseBody instanceof Blob) {
|
392
|
+
// Clone the blob to ensure it's not consumed
|
393
|
+
responseBody = entry.body.slice(0, entry.body.size, entry.body.type);
|
394
|
+
}
|
395
|
+
|
389
396
|
// Create Response safely
|
390
397
|
let response;
|
391
398
|
try {
|
392
|
-
response = new Response(
|
399
|
+
response = new Response(responseBody, {
|
393
400
|
status: entry.status,
|
394
401
|
statusText: entry.statusText,
|
395
402
|
headers: responseHeaders
|
@@ -444,9 +451,10 @@ export default class IndexedDbCache {
|
|
444
451
|
} else {
|
445
452
|
concurrentReadsByKey.set(key, current - 1);
|
446
453
|
}
|
447
|
-
|
448
|
-
|
449
|
-
|
454
|
+
|
455
|
+
// console.debug(
|
456
|
+
// `Concurrent reads for ${key} after decrement: ${current - 1}`
|
457
|
+
// );
|
450
458
|
}
|
451
459
|
}
|
452
460
|
|