From e5f04527282a40dfa35d756c2f4b3a172e461065 Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Sat, 7 Jan 2023 22:31:15 +0000 Subject: [PATCH] Don't initialize KBar when unauthed (#6328) * Don't initialize KBar when unauthed * Don't render trigger when query is undefined --- packages/ui/v2/core/Kbar.tsx | 4 ++-- packages/ui/v2/core/Shell.tsx | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/ui/v2/core/Kbar.tsx b/packages/ui/v2/core/Kbar.tsx index 8d106fd0e2..8378751456 100644 --- a/packages/ui/v2/core/Kbar.tsx +++ b/packages/ui/v2/core/Kbar.tsx @@ -273,7 +273,7 @@ export const KBarContent = () => { export const KBarTrigger = () => { const { query } = useKBar(); - return ( + return query ? ( <> - ); + ) : null; }; const DisplayShortcuts = (item: shortcutArrayType) => { diff --git a/packages/ui/v2/core/Shell.tsx b/packages/ui/v2/core/Shell.tsx index d64f164596..8909da9200 100644 --- a/packages/ui/v2/core/Shell.tsx +++ b/packages/ui/v2/core/Shell.tsx @@ -195,8 +195,13 @@ export default function Shell(props: LayoutProps) { useRedirectToLoginIfUnauthenticated(props.isPublic); useRedirectToOnboardingIfNeeded(); useTheme("light"); - - return ( + // don't load KBar when unauthed + return props.isPublic ? ( + <> + + + + ) : (