@nxtedition/cache 2.1.3 → 2.1.4

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.
Files changed (2) hide show
  1. package/lib/index.js +7 -5
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -425,6 +425,13 @@ export class Cache extends EventEmi
425
425
  return { value: cached?.value, async: false }
426
426
  }
427
427
 
428
+ {
429
+ const pending = this.#dedupe.get(key)
430
+ if (pending !== undefined) {
431
+ return { async: true, value: pending }
432
+ }
433
+ }
434
+
428
435
  let result
429
436
  try {
430
437
  result = this.#refresh(args, key)
@@ -448,11 +455,6 @@ export class Cache extends EventEmi
448
455
  throw new TypeError('keySelector must return a non-empty string')
449
456
  }
450
457
 
451
- const existing = this.#dedupe.get(key)
452
- if (existing !== undefined) {
453
- return { async: true, value: existing }
454
- }
455
-
456
458
  if (this.#lockTimeout >= 0) {
457
459
  // Another process holds the lock — wait for the value instead of calling valueSelector.
458
460
  // Use deferred pattern so #waitForValue can check promise identity to detect delete+get races.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/cache",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -30,5 +30,5 @@
30
30
  "tsd": "^0.33.0",
31
31
  "typescript": "^5.9.3"
32
32
  },
33
- "gitHead": "9eb1dad9a2389d494b2e7fba2e5c149fa0872d53"
33
+ "gitHead": "f7c04358e008a7b0f28e2ca76a81ebdc07fbd734"
34
34
  }