From a11854d9573c2aec6640910ad0fbcea0231f7aeb Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 24 Oct 2022 09:13:05 +0100 Subject: [PATCH] Fix issue with getting environment details --- packages/client/src/index.js | 2 +- packages/client/src/stores/environment.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/client/src/index.js b/packages/client/src/index.js index f49e6df5a2..951c55270b 100644 --- a/packages/client/src/index.js +++ b/packages/client/src/index.js @@ -47,7 +47,7 @@ const loadBudibase = async () => { appStore.actions.setAppId(window["##BUDIBASE_APP_ID##"]) // Fetch environment info - if (!get(environmentStore)) { + if (!get(environmentStore)?.loaded) { await environmentStore.actions.fetchEnvironment() } diff --git a/packages/client/src/stores/environment.js b/packages/client/src/stores/environment.js index ebeb67c622..bcc1493cd9 100644 --- a/packages/client/src/stores/environment.js +++ b/packages/client/src/stores/environment.js @@ -2,6 +2,7 @@ import { API } from "api" import { writable } from "svelte/store" const initialState = { + loaded: false, cloud: false, } @@ -15,6 +16,7 @@ const createEnvironmentStore = () => { store.set({ ...initialState, ...environment, + loaded: true, }) } catch (error) { store.set(initialState)