Skip to content

Commit 4179772

Browse files
committed
fix(connectors): grain check transcript before formatting; gong cache date window across cursor pages
1 parent 836ba53 commit 4179772

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

apps/sim/connectors/gong/gong.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,16 @@ export const gongConnector: ConnectorConfig = {
372372
const workspaceId = (sourceConfig.workspaceId as string | undefined)?.trim()
373373
const primaryUserIds = parseIdList(sourceConfig.primaryUserIds)
374374

375+
const cachedWindow = syncContext?.gongDateWindow as
376+
| { fromDateTime: string; toDateTime: string }
377+
| undefined
375378
const now = new Date()
376-
const fromDateTime = new Date(now.getTime() - lookbackDays * MS_PER_DAY).toISOString()
377-
const toDateTime = now.toISOString()
379+
const window = cachedWindow ?? {
380+
fromDateTime: new Date(now.getTime() - lookbackDays * MS_PER_DAY).toISOString(),
381+
toDateTime: now.toISOString(),
382+
}
383+
if (syncContext && !cachedWindow) syncContext.gongDateWindow = window
384+
const { fromDateTime, toDateTime } = window
378385

379386
const filter: Record<string, unknown> = { fromDateTime, toDateTime }
380387
if (workspaceId) filter.workspaceId = workspaceId

apps/sim/connectors/grain/grain.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,13 +446,14 @@ export const grainConnector: ConnectorConfig = {
446446
const segments = await fetchTranscript(accessToken, externalId)
447447
if (!segments) return null
448448

449-
const content = formatTranscriptContent(recording, segments)
450449
const hasTranscript = segments.some((segment) => segment.text?.trim())
451450
if (!hasTranscript) {
452451
logger.info('Transcript not yet available for Grain recording', { externalId })
453452
return null
454453
}
455454

455+
const content = formatTranscriptContent(recording, segments)
456+
456457
return {
457458
externalId,
458459
title: recordingTitle(recording),

0 commit comments

Comments
 (0)