From c3366055293bb4af986482b792eeea358af9db33 Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Tue, 29 Sep 2020 15:35:51 +0100 Subject: [PATCH] added comment --- packages/builder/src/components/start/CreateAppModal.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/components/start/CreateAppModal.svelte b/packages/builder/src/components/start/CreateAppModal.svelte index fee827b9d4..7f23e73230 100644 --- a/packages/builder/src/components/start/CreateAppModal.svelte +++ b/packages/builder/src/components/start/CreateAppModal.svelte @@ -28,8 +28,10 @@ const validateApiKey = async apiKey => { if (!apiKey) return false - // make sure we only fetch once + // make sure we only fetch once, unless API Key is changed if (isApiKeyValid === undefined || apiKey !== lastApiKey) { + // svelte reactivity was causing a requst to get fired mutiple times + // so, we make everything await the same promise, if one exists if (!fetchApiKeyPromise) { fetchApiKeyPromise = analytics.identifyByApiKey(apiKey) }