mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix(agent): export waits for complete workflow state (#889)
* Fix yaml export race condition * Fix env.ts dev
This commit is contained in:
+2
-2
@@ -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')
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user