@fireproof/core 0.7.2-dev.7 → 0.7.2

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.
@@ -276,12 +276,10 @@ export class Base {
276
276
  }
277
277
  carReaderCache = new Map();
278
278
  async getCarReader(carCid) {
279
- if (this.carReaderCache.has(carCid)) {
280
- return this.carReaderCache.get(carCid);
279
+ if (!this.carReaderCache.has(carCid)) {
280
+ this.carReaderCache.set(carCid, this.getCarReaderImpl(carCid));
281
281
  }
282
- const result = await this.getCarReaderImpl(carCid);
283
- this.carReaderCache.set(carCid, result);
284
- return result;
282
+ return this.carReaderCache.get(carCid);
285
283
  }
286
284
  async getCarReaderImpl(carCid) {
287
285
  carCid = carCid.toString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fireproof/core",
3
- "version": "0.7.2-dev.7",
3
+ "version": "0.7.2",
4
4
  "description": "Live data for React, accelerated by proofs, powered by IPFS",
5
5
  "main": "dist/src/fireproof.js",
6
6
  "module": "dist/src/fireproof.mjs",
@@ -295,12 +295,10 @@ export class Base {
295
295
 
296
296
  carReaderCache = new Map()
297
297
  async getCarReader (carCid) {
298
- if (this.carReaderCache.has(carCid)) {
299
- return this.carReaderCache.get(carCid)
298
+ if (!this.carReaderCache.has(carCid)) {
299
+ this.carReaderCache.set(carCid, this.getCarReaderImpl(carCid))
300
300
  }
301
- const result = await this.getCarReaderImpl(carCid)
302
- this.carReaderCache.set(carCid, result)
303
- return result
301
+ return this.carReaderCache.get(carCid)
304
302
  }
305
303
 
306
304
  async getCarReaderImpl (carCid) {