File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
apps/web/components/onboarding/setup Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -381,11 +381,9 @@ export function ChatSidebar({ formData }: ChatSidebarProps) {
381381 setIsLoading ( true )
382382
383383 try {
384- const documentIds : string [ ] = [ ]
385-
386- for ( const draft of draftDocs ) {
384+ const promises = draftDocs . map ( async ( draft ) => {
387385 if ( draft . kind === "x_research" && xResearchStatus !== "correct" ) {
388- continue
386+ return null
389387 }
390388
391389 try {
@@ -397,13 +395,17 @@ export function ChatSidebar({ formData }: ChatSidebarProps) {
397395 } ,
398396 } )
399397
400- if ( docResponse . data ?. id ) {
401- documentIds . push ( docResponse . data . id )
402- }
398+ return docResponse . data ?. id
403399 } catch ( error ) {
404400 console . warn ( "Error creating document:" , error )
401+ return null
405402 }
406- }
403+ } )
404+
405+ const results = await Promise . all ( promises )
406+ const documentIds = results . filter (
407+ ( id ) : id is string => id !== null && id !== undefined ,
408+ )
407409
408410 if ( documentIds . length > 0 ) {
409411 await pollForMemories ( documentIds )
You can’t perform that action at this time.
0 commit comments