From 79e29d2677693a1a285e9e387f8505c99a148547 Mon Sep 17 00:00:00 2001 From: Andrew Wylde Date: Tue, 5 Mar 2024 10:59:14 -0600 Subject: [PATCH] refactor: load ld if not loaded (#454) --- src/composables/useLaunchDarkly.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/composables/useLaunchDarkly.ts b/src/composables/useLaunchDarkly.ts index fd969aeb..12a9d07b 100644 --- a/src/composables/useLaunchDarkly.ts +++ b/src/composables/useLaunchDarkly.ts @@ -16,6 +16,7 @@ async function loadDeps () { } } catch (e) { // ignore failure to import as it's an optional dependency + console.error(e) } } } @@ -33,6 +34,10 @@ export default function useLaunchDarkly () { return } + if (!ldModule) { + await loadDeps() + } + try { ldClient = ldModule.initialize( featuresetId.value,