From b252c07499d6764dde1b00cd2899aa12fe9a2480 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Wed, 1 Feb 2023 10:37:06 +0100 Subject: [PATCH] docs: only initialize unleash if config is valid --- website/src/theme/Root.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website/src/theme/Root.tsx b/website/src/theme/Root.tsx index c69cb7cb8d..ec60099a90 100644 --- a/website/src/theme/Root.tsx +++ b/website/src/theme/Root.tsx @@ -16,9 +16,11 @@ function Root({ children }) { appName: `docs.getunleash.io-${customFields.environment}`, }; + const configIsValid = unleashConfig.clientKey && unleashConfig.url; + const [showFeedback, setShowFeedback] = React.useState(false); - if (typeof fetch !== 'undefined') { + if (configIsValid && typeof fetch !== 'undefined') { try { const unleash = new UnleashClient(unleashConfig); unleash.on('ready', () => {