chore: skip picking if VEGA_URL set

This commit is contained in:
asiaznik 2024-03-08 14:11:42 +01:00
parent b0bbae4c2e
commit 002738af70
No known key found for this signature in database
GPG Key ID: 4D5C8972A02C52C2

View File

@ -619,12 +619,6 @@ export const useEnvironment = create<EnvStore>()((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<EnvStore>()((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) {