diff --git a/packages/client/src/index.js b/packages/client/src/index.js index 3d0aaa1038..0e8ab8c258 100644 --- a/packages/client/src/index.js +++ b/packages/client/src/index.js @@ -1,5 +1,11 @@ import ClientApp from "./components/ClientApp.svelte" -import { componentStore, builderStore, appStore, devToolsStore } from "./stores" +import { + componentStore, + builderStore, + appStore, + devToolsStore, + environmentStore, +} from "./stores" import loadSpectrumIcons from "@budibase/bbui/spectrum-icons-rollup.js" import { get } from "svelte/store" import { initWebsocket } from "./websocket.js" @@ -15,7 +21,7 @@ loadSpectrumIcons() let app -const loadBudibase = () => { +const loadBudibase = async () => { // Update builder store with any builder flags builderStore.set({ inBuilder: !!window["##BUDIBASE_IN_BUILDER##"], @@ -36,6 +42,9 @@ const loadBudibase = () => { // server rendered app HTML appStore.actions.setAppId(window["##BUDIBASE_APP_ID##"]) + // Fetch environment info + await environmentStore.actions.fetchEnvironment() + // Enable dev tools or not. We need to be using a dev app and not inside // the builder preview to enable them. const enableDevTools = !get(builderStore).inBuilder && get(appStore).isDevApp diff --git a/packages/client/src/stores/initialise.js b/packages/client/src/stores/initialise.js index 4ad85dfd40..1900e62ce1 100644 --- a/packages/client/src/stores/initialise.js +++ b/packages/client/src/stores/initialise.js @@ -1,9 +1,7 @@ import { routeStore } from "./routes" import { appStore } from "./app" -import { environmentStore } from "./environment" export async function initialise() { await routeStore.actions.fetchRoutes() await appStore.actions.fetchAppDefinition() - await environmentStore.actions.fetchEnvironment() }