Skip to content

Commit fece740

Browse files
committed
fix(kb): correct errors type and refresh on partial failure
1 parent 7479225 commit fece740

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -538,14 +538,11 @@ export function Document({
538538
},
539539
{
540540
onSuccess: (result) => {
541-
if (operation === 'delete') {
541+
if (operation === 'delete' || result.errorCount > 0) {
542542
refreshChunks()
543543
} else {
544-
const failedChunkIds = new Set(result.errors.map((e) => e.chunkId))
545544
chunks.forEach((chunk) => {
546-
if (!failedChunkIds.has(chunk.id)) {
547-
updateChunk(chunk.id, { enabled: operation === 'enable' })
548-
}
545+
updateChunk(chunk.id, { enabled: operation === 'enable' })
549546
})
550547
}
551548
logger.info(`Successfully ${operation}d ${result.successCount} chunks`)

apps/sim/hooks/queries/knowledge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ export interface BulkChunkOperationResult {
759759
successCount: number
760760
errorCount: number
761761
processed: number
762-
errors: Array<{ chunkId: string; error: string }>
762+
errors: string[]
763763
}
764764

765765
export async function bulkChunkOperation({

0 commit comments

Comments
 (0)