fix(agent): export waits for complete workflow state (#889)

* Fix yaml export race condition

* Fix env.ts dev
This commit is contained in:
Siddharth Ganesan
2025-08-06 11:28:34 -07:00
committed by GitHub
parent a3a5bf1d76
commit 05e689bc60
2 changed files with 5 additions and 5 deletions
@@ -37,7 +37,7 @@ export function ExportControls({ disabled = false }: ExportControlsProps) {
}
}
const handleExportYaml = () => {
const handleExportYaml = async () => {
if (!currentWorkflow || !activeWorkflowId) {
logger.warn('No active workflow to export')
return
@@ -45,7 +45,7 @@ export function ExportControls({ disabled = false }: ExportControlsProps) {
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')
+3 -3
View File
@@ -13,7 +13,7 @@ interface WorkflowYamlState {
interface WorkflowYamlActions {
generateYaml: () => Promise<void>
getYaml: () => string
getYaml: () => Promise<string>
refreshYaml: () => void
}
@@ -151,7 +151,7 @@ export const useWorkflowYamlStore = create<WorkflowYamlStore>()(
}
},
getYaml: () => {
getYaml: async () => {
// Initialize subscriptions on first use
initializeSubscriptions()
@@ -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
}