From 002738af7052ef89cc2289818a3d03084d0b5b7f Mon Sep 17 00:00:00 2001 From: asiaznik Date: Fri, 8 Mar 2024 14:11:42 +0100 Subject: [PATCH] chore: skip picking if VEGA_URL set --- libs/environment/src/hooks/use-environment.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/environment/src/hooks/use-environment.ts b/libs/environment/src/hooks/use-environment.ts index 54bed0e18..f1652caec 100644 --- a/libs/environment/src/hooks/use-environment.ts +++ b/libs/environment/src/hooks/use-environment.ts @@ -619,12 +619,6 @@ export const useEnvironment = create()((set, get) => ({ const state = get(); - // skip picking up the best node if VEGA_URL env variable is set - if (state.VEGA_URL && isValidUrl(state.VEGA_URL)) { - state.setUrl(state.VEGA_URL); - return; - } - let storedUrl = LocalStorage.getItem(STORAGE_KEY); if (!isValidUrl(storedUrl)) { // remove invalid data from local storage @@ -649,6 +643,12 @@ export const useEnvironment = create()((set, get) => ({ console.warn(`Could not fetch node config from ${state.VEGA_CONFIG_URL}`); } + // skip picking up the best node if VEGA_URL env variable is set + if (state.VEGA_URL && isValidUrl(state.VEGA_URL)) { + state.setUrl(state.VEGA_URL); + return; + } + // No url found in env vars or localStorage, AND no nodes were found in // the config fetched from VEGA_CONFIG_URL, app initialization has failed if (!nodes || !nodes.length) {