From 50494e6136e977d5d989c2648d1191c60b870040 Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Thu, 1 Oct 2020 09:28:55 +0100 Subject: [PATCH 1/2] bugfix: create app modal always appears on homescreen --- packages/builder/src/pages/index.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/pages/index.svelte b/packages/builder/src/pages/index.svelte index d0c471d30..58beb4bbe 100644 --- a/packages/builder/src/pages/index.svelte +++ b/packages/builder/src/pages/index.svelte @@ -37,7 +37,9 @@ if (keys.userId) { hasKey = true analytics.identify(keys.userId) - } else { + } + + if (!keys.budibase) { showCreateAppModal() } } From c50f2caedf4129b5496e448079eed217282c0cd0 Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Thu, 1 Oct 2020 09:29:30 +0100 Subject: [PATCH 2/2] bugfix: dont try to log to analytics when no config --- packages/builder/src/analytics.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/packages/builder/src/analytics.js b/packages/builder/src/analytics.js index 8761d463c..60a41e42c 100644 --- a/packages/builder/src/analytics.js +++ b/packages/builder/src/analytics.js @@ -3,6 +3,8 @@ import posthog from "posthog-js" import api from "builderStore/api" let analyticsEnabled +const posthogConfigured = process.env.POSTHOG_TOKEN && process.env.POSTHOG_URL +const sentryConfigured = process.env.SENTRY_DSN async function activate() { if (analyticsEnabled === undefined) { @@ -13,21 +15,22 @@ async function activate() { analyticsEnabled = (await response.json()) === true } if (!analyticsEnabled) return - Sentry.init({ dsn: process.env.SENTRY_DSN }) - if (!process.env.POSTHOG_TOKEN) return - posthog.init(process.env.POSTHOG_TOKEN, { - api_host: process.env.POSTHOG_URL, - }) - posthog.set_config({ persistence: "cookie" }) + if (sentryConfigured) Sentry.init({ dsn: process.env.SENTRY_DSN }) + if (posthogConfigured) { + posthog.init(process.env.POSTHOG_TOKEN, { + api_host: process.env.POSTHOG_URL, + }) + posthog.set_config({ persistence: "cookie" }) + } } function identify(id) { - if (!analyticsEnabled) return - if (!id) return - posthog.identify(id) - Sentry.configureScope(scope => { - scope.setUser({ id: id }) - }) + if (!analyticsEnabled || !id) return + if (posthogConfigured) posthog.identify(id) + if (sentryConfigured) + Sentry.configureScope(scope => { + scope.setUser({ id: id }) + }) } async function identifyByApiKey(apiKey) {