mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
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:
@@ -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',
|
||||
})
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user