fix(dbsync): sync state right before deploying as API to enusre localStorage & db workflow state are the same as soon as the endpoint is deployed

This commit is contained in:
Waleed Latif
2025-02-23 15:49:47 -08:00
parent f52de5d1d6
commit 3f4e6041ce
2 changed files with 5 additions and 1 deletions
@@ -25,6 +25,7 @@ import {
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { cn } from '@/lib/utils'
import { useNotificationStore } from '@/stores/notifications/store'
import { performSync } from '@/stores/sync-manager'
import { useWorkflowRegistry } from '@/stores/workflow/registry/store'
import { useWorkflowStore } from '@/stores/workflow/store'
import { useWorkflowExecution } from '../../hooks/use-workflow-execution'
@@ -131,6 +132,9 @@ export function ControlBar() {
if (!activeWorkflowId) return
try {
setIsDeploying(true)
await performSync()
const response = await fetch(`/api/workflow/${activeWorkflowId}/deploy`, {
method: 'POST',
})
+1 -1
View File
@@ -130,7 +130,7 @@ async function syncWorkflowsToServer(payloads: WorkflowSyncPayload[]): Promise<b
}
// Periodic sync execution
async function performSync(): Promise<void> {
export async function performSync(): Promise<void> {
const { workflows } = useWorkflowRegistry.getState()
const syncPayloads = await Promise.all(