Skip to content

Commit 87105a5

Browse files
committed
fix(user-input): narrow ChatContext discriminated union before accessing workflowId
1 parent 067751c commit 87105a5

File tree

1 file changed

+5
-1
lines changed
  • apps/sim/app/workspace/[workspaceId]/home/components/user-input

1 file changed

+5
-1
lines changed

apps/sim/app/workspace/[workspaceId]/home/components/user-input/user-input.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,10 +671,14 @@ export function UserInput({
671671
: range.token
672672
const matchingCtx = contexts.find((c) => c.label === mentionLabel)
673673

674+
const wfId =
675+
matchingCtx?.kind === 'workflow' || matchingCtx?.kind === 'current_workflow'
676+
? matchingCtx.workflowId
677+
: undefined
674678
const mentionIconNode = matchingCtx ? (
675679
<ContextMentionIcon
676680
context={matchingCtx}
677-
workflowColor={workflowsById[matchingCtx.workflowId ?? '']?.color ?? null}
681+
workflowColor={wfId ? (workflowsById[wfId]?.color ?? null) : null}
678682
className='absolute inset-0 m-auto h-[12px] w-[12px] text-[var(--text-icon)]'
679683
/>
680684
) : null

0 commit comments

Comments
 (0)