Skip to content

Commit f4c4a7f

Browse files
FinickySpiderpionxzh
authored andcommitted
fix(api): fix project-level chat export stuck at "Loading"
Fixes #305
1 parent d34a575 commit f4c4a7f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/api.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,13 +495,16 @@ export async function fetchAllConversations(project: string | null = null, maxCo
495495
let offset = 0
496496
while (true) {
497497
try {
498-
const result = await fetchConversations(offset, limit, project)
498+
const result = project === null
499+
? await fetchConversations(offset, limit)
500+
: await fetchProjectConversations(project, offset, limit)
499501
if (!result.items) {
500502
// Handle potential API errors or empty responses
501503
console.warn('fetchAllConversations received no items at offset:', offset)
502504
break
503505
}
504506
conversations.push(...result.items)
507+
if (result.items.length === 0) break
505508
// Stop if we've reached the total reported by the API OR the user-defined limit
506509
if (result.total !== null && offset + limit >= result.total) break
507510
if (conversations.length >= maxConversations) break

0 commit comments

Comments
 (0)