Skip to content

Commit

Permalink
fix(network): disable browser cache in dev mode (#213)
Browse files Browse the repository at this point in the history
* fix(network): disable browser cache in dev mode

* fix(network): use -1 for cache block number when cache is disabled
  • Loading branch information
Kooshaba committed Nov 9, 2022
1 parent 868ae02 commit ba9e6bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/network/src/workers/SyncWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export class SyncWorker<C extends Components> implements DoWork<Input, NetworkEv
provider: { options: providerOptions },
initialBlockNumber,
fetchSystemCalls,
disableCache,
} = config;

// Set default values for cacheAgeThreshold and cacheInterval
Expand Down Expand Up @@ -193,7 +194,7 @@ export class SyncWorker<C extends Components> implements DoWork<Input, NetworkEv

// Load initial state from cache or snapshot service
this.setLoadingState({ state: SyncState.INITIAL, msg: "Fetching cache block number", percentage: 0 });
const cacheBlockNumber = await getIndexDBCacheStoreBlockNumber(indexDbCache);
const cacheBlockNumber = !disableCache ? await getIndexDBCacheStoreBlockNumber(indexDbCache) : -1;
this.setLoadingState({ percentage: 50 });
const snapshotBlockNumber = await getSnapshotBlockNumber(snapshotClient, worldContract.address);
this.setLoadingState({ percentage: 100 });
Expand Down

0 comments on commit ba9e6bc

Please sign in to comment.