Skip to content
Merged
Show file tree
Hide file tree
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 @@ -37,15 +37,15 @@ export function ExportControls({ disabled = false }: ExportControlsProps) {
}
}

const handleExportYaml = () => {
const handleExportYaml = async () => {
if (!currentWorkflow || !activeWorkflowId) {
logger.warn('No active workflow to export')
return
}

setIsExporting(true)
try {
const yamlContent = getYaml()
const yamlContent = await getYaml()
const filename = `${currentWorkflow.name.replace(/[^a-z0-9]/gi, '-')}.yaml`

downloadFile(yamlContent, filename, 'text/yaml')
Expand Down
6 changes: 3 additions & 3 deletions apps/sim/stores/workflows/yaml/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface WorkflowYamlState {

interface WorkflowYamlActions {
generateYaml: () => Promise<void>
getYaml: () => string
getYaml: () => Promise<string>
refreshYaml: () => void
}

Expand Down Expand Up @@ -151,7 +151,7 @@ export const useWorkflowYamlStore = create<WorkflowYamlStore>()(
}
},

getYaml: () => {
getYaml: async () => {
// Initialize subscriptions on first use
initializeSubscriptions()

Expand All @@ -160,7 +160,7 @@ export const useWorkflowYamlStore = create<WorkflowYamlStore>()(

// Auto-refresh if data is stale (older than 1 second) or never generated
if (!lastGenerated || currentTime - lastGenerated > 1000) {
get().generateYaml()
await get().generateYaml()
return get().yaml
}

Expand Down