Skip to content

Commit

Permalink
fix: intermittent e2e failures (#15)
Browse files Browse the repository at this point in the history
Co-authored-by: Ibrahim <[email protected]>
Co-authored-by: bferenc <[email protected]>
  • Loading branch information
3 people authored Aug 6, 2024
1 parent 55adf66 commit 00c212b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions src/background/services/network/NetworkService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ export class NetworkService implements OnLock, OnStorageReady {
// At this point the chainlist from Glacier should already be available,
// as it is fetched when service worker starts (so before extension is unlocked).
// If it isn't available yet, we'll use the list cached in the storage.
const chainlist = await Promise.race([

const chainlist = await Promise.any([
this._chainListFetched.promisify(),
this._getCachedChainList(),
]);
Expand Down Expand Up @@ -358,7 +359,15 @@ export class NetworkService implements OnLock, OnStorageReady {
}

private async _getCachedChainList(): Promise<ChainList | undefined> {
return this.storageService.load<ChainList>(NETWORK_LIST_STORAGE_KEY);
const networkList = await this.storageService.load<ChainList>(
NETWORK_LIST_STORAGE_KEY
);

if (!networkList) {
throw new Error('No networks cached');
}

return networkList;
}

private _getPchainNetwork(isTestnet: boolean): Network {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"sourceMap": true,
"jsx": "react-jsx",
"esModuleInterop": true,
"lib": ["es2015", "dom"],
"lib": ["es2015", "es2021", "dom"],
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"allowSyntheticDefaultImports": true,
Expand Down

0 comments on commit 00c212b

Please sign in to comment.