From 1b40cedd236e1db8d27061135059423ad1881d86 Mon Sep 17 00:00:00 2001 From: Ishaan Gupta Date: Thu, 2 Apr 2026 10:17:53 +0530 Subject: [PATCH] Optimize onboarding chat document creation with Promise.all --- apps/web/components/onboarding/setup/chat-sidebar.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/web/components/onboarding/setup/chat-sidebar.tsx b/apps/web/components/onboarding/setup/chat-sidebar.tsx index 501c8fd6..edeec1b5 100644 --- a/apps/web/components/onboarding/setup/chat-sidebar.tsx +++ b/apps/web/components/onboarding/setup/chat-sidebar.tsx @@ -40,6 +40,10 @@ interface DraftDoc { } export function ChatSidebar({ formData }: ChatSidebarProps) { + const isValidDocId = ( + id: string | null | undefined, + ): id is string => !!id + const { user } = useAuth() const { selectedProject } = useProject() const isMobile = useIsMobile() @@ -397,7 +401,7 @@ export function ChatSidebar({ formData }: ChatSidebarProps) { }, }) - if (docResponse.data?.id) { + if (isValidDocId(docResponse.data?.id)) { documentIds.push(docResponse.data.id) } } catch (error) {