diff --git a/apps/deploy-web/mvm.lock b/apps/deploy-web/mvm.lock index 2d61b31c3..c9805f8fe 100644 --- a/apps/deploy-web/mvm.lock +++ b/apps/deploy-web/mvm.lock @@ -2,7 +2,7 @@ "dependencies": { "@akashnetwork/env-loader": "1.0.1", "@akashnetwork/http-sdk": "1.0.7", - "@akashnetwork/network-store": "1.0.0", + "@akashnetwork/network-store": "1.0.1", "@akashnetwork/ui": "1.0.0" }, "devDependencies": { diff --git a/apps/stats-web/mvm.lock b/apps/stats-web/mvm.lock index 0bb32c6e6..0d99ab6a5 100644 --- a/apps/stats-web/mvm.lock +++ b/apps/stats-web/mvm.lock @@ -1,6 +1,6 @@ { "dependencies": { - "@akashnetwork/network-store": "1.0.0", + "@akashnetwork/network-store": "1.0.1", "@akashnetwork/ui": "1.0.0" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index 0c18ca3d6..904c2f8e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,7 @@ }, "apps/api": { "name": "@akashnetwork/console-api", - "version": "2.26.0", + "version": "2.28.0-beta.0", "license": "Apache-2.0", "dependencies": { "@akashnetwork/akash-api": "^1.3.0", @@ -270,7 +270,7 @@ }, "apps/deploy-web": { "name": "@akashnetwork/console-web", - "version": "2.20.1", + "version": "2.20.2", "license": "Apache-2.0", "dependencies": { "@akashnetwork/akash-api": "^1.3.0", @@ -700,7 +700,7 @@ }, "apps/provider-proxy": { "name": "console-provider-proxy", - "version": "1.0.11", + "version": "1.0.12", "license": "Apache-2.0", "dependencies": { "axios": "^1.7.2", @@ -39460,7 +39460,7 @@ }, "packages/network-store": { "name": "@akashnetwork/network-store", - "version": "1.0.0", + "version": "1.0.1", "license": "Apache-2.0", "dependencies": { "axios": "^1.7.2", diff --git a/packages/network-store/package.json b/packages/network-store/package.json index 38e923ed7..16fa10a92 100644 --- a/packages/network-store/package.json +++ b/packages/network-store/package.json @@ -1,6 +1,6 @@ { "name": "@akashnetwork/network-store", - "version": "1.0.0", + "version": "1.0.1", "description": "Package containing browser storage for Akash Network", "keywords": [], "license": "Apache-2.0", diff --git a/packages/network-store/src/network.store.ts b/packages/network-store/src/network.store.ts index 25409662f..ea911cdc1 100644 --- a/packages/network-store/src/network.store.ts +++ b/packages/network-store/src/network.store.ts @@ -4,7 +4,7 @@ import { getDefaultStore, useAtom } from "jotai"; import { atomWithStorage } from "jotai/utils"; import cloneDeep from "lodash/cloneDeep"; -import { INITIAL_NETWORKS_CONFIG, MAINNET_ID, SANDBOX_ID } from "./network.config"; +import { INITIAL_NETWORKS_CONFIG } from "./network.config"; import type { Network } from "./network.type"; interface NetworkStoreOptions { @@ -19,6 +19,8 @@ interface NetworksStore { data: Network[]; } +const networkIds = INITIAL_NETWORKS_CONFIG.map(({ id }) => id); + class NetworkStoreVersionsInitError extends Error { errors: Error[]; constructor(errors: { network: Network; error: Error }[]) { @@ -84,13 +86,21 @@ export class NetworkStore { } const raw = localStorage.getItem(this.STORAGE_KEY); + if (networkIds.some(id => id === raw)) { + return raw; + } + if (!raw) { return this.options.defaultNetworkId; } - const parsed = JSON.parse(raw); + try { + const parsed = JSON.parse(raw); - return [MAINNET_ID, SANDBOX_ID].includes(parsed) ? parsed : this.options.defaultNetworkId; + return networkIds.includes(parsed) ? parsed : this.options.defaultNetworkId; + } catch (error) { + return this.options.defaultNetworkId; + } } private async initiateNetworks() {