Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -392,32 +392,38 @@ export function BrowserAutomations({ taskId, isManualTask = false }: BrowserAuto
// connects here, `justConnected` advances to the "add your first automation"
// state. Connections are org-level and reused, so connecting an already-connected
// vendor simply reuses the saved session.
// A pending draft means the task is mid-setup — don't drop back to first-run.
if (
!isManualTask &&
automations.automations.length === 0 &&
!justConnected &&
drafts.length === 0
) {
return (
<BrowserEvidenceEmptyState
isStartingAuth={context.isStartingAuth}
onConnect={() => setConnectOpen(true)}
// No saved automations yet.
if (!isManualTask && automations.automations.length === 0) {
// An automation can only be built on an existing connection — the composer
// opens on one. With no connection (and none just made — the profile list
// refetches a beat after connecting), "Create" would silently no-op because
// there's nothing to open the composer on, so prompt to connect first.
// Drafts are still surfaced above so they can be resumed either way.
const hasConnection = profiles.length > 0;
const draftsStrip = drafts.length > 0 && (
<DraftsStrip
drafts={drafts}
profiles={profiles}
onContinue={handleContinueDraft}
onDelete={handleDeleteDraft}
/>
);
}

// No saved automations yet, but a connection and/or a draft exists — prompt to
// create the first one, with any drafts pinned above to resume.
if (!isManualTask && automations.automations.length === 0) {
if (!hasConnection && !justConnected) {
return (
<>
{draftsStrip}
<BrowserEvidenceEmptyState
isStartingAuth={context.isStartingAuth}
onConnect={() => setConnectOpen(true)}
/>
</>
);
}

return (
<>
<DraftsStrip
drafts={drafts}
profiles={profiles}
onContinue={handleContinueDraft}
onDelete={handleDeleteDraft}
/>
{draftsStrip}
<EmptyWithContextState
onCreateClick={() => setComposer({ open: true, mode: 'create' })}
/>
Expand Down
Loading