Skip to content

Commit 8c409c2

Browse files
waleedlatif1claude
andcommitted
fix(sync-engine): merge title from getDocument and skip unchanged docs after hydration
- Merge title from getDocument during deferred hydration so Gmail documents get the email Subject header instead of the snippet text - After hydration, compare the hydrated contentHash against the stored DB hash — if they match, skip the update. This prevents Obsidian (and any connector with a force-refresh stub hash) from re-uploading and re-processing unchanged documents every sync Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent eb78814 commit 8c409c2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

apps/sim/lib/knowledge/connectors/sync-engine.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,12 +456,21 @@ export async function executeSync(
456456
syncContext
457457
)
458458
if (!fullDoc?.content.trim()) return null
459+
const hydratedHash = fullDoc.contentHash ?? op.extDoc.contentHash
460+
if (
461+
op.type === 'update' &&
462+
existingByExternalId.get(op.extDoc.externalId)?.contentHash === hydratedHash
463+
) {
464+
result.docsUnchanged++
465+
return null
466+
}
459467
return {
460468
...op,
461469
extDoc: {
462470
...op.extDoc,
471+
title: fullDoc.title || op.extDoc.title,
463472
content: fullDoc.content,
464-
contentHash: fullDoc.contentHash ?? op.extDoc.contentHash,
473+
contentHash: hydratedHash,
465474
contentDeferred: false,
466475
metadata: { ...op.extDoc.metadata, ...fullDoc.metadata },
467476
},

0 commit comments

Comments
 (0)