mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-17 02:48:02 -05:00
Compare commits
1 Commits
main
...
fix/refres
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2325cad1f |
@@ -1,7 +1,7 @@
|
|||||||
import type React from 'react'
|
import type React from 'react'
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import { createLogger } from '@sim/logger'
|
import { createLogger } from '@sim/logger'
|
||||||
import { useQuery } from '@tanstack/react-query'
|
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
||||||
import { Loader2, WrenchIcon, XIcon } from 'lucide-react'
|
import { Loader2, WrenchIcon, XIcon } from 'lucide-react'
|
||||||
import { useParams } from 'next/navigation'
|
import { useParams } from 'next/navigation'
|
||||||
import {
|
import {
|
||||||
@@ -943,8 +943,9 @@ export function ToolInput({
|
|||||||
const params = useParams()
|
const params = useParams()
|
||||||
const workspaceId = params.workspaceId as string
|
const workspaceId = params.workspaceId as string
|
||||||
const workflowId = params.workflowId as string
|
const workflowId = params.workflowId as string
|
||||||
|
const queryClient = useQueryClient()
|
||||||
const [storeValue, setStoreValue] = useSubBlockValue(blockId, subBlockId)
|
const [storeValue, setStoreValue] = useSubBlockValue(blockId, subBlockId)
|
||||||
const [open, setOpen] = useState(false)
|
const [_, setOpen] = useState(false)
|
||||||
const [customToolModalOpen, setCustomToolModalOpen] = useState(false)
|
const [customToolModalOpen, setCustomToolModalOpen] = useState(false)
|
||||||
const [editingToolIndex, setEditingToolIndex] = useState<number | null>(null)
|
const [editingToolIndex, setEditingToolIndex] = useState<number | null>(null)
|
||||||
const [draggedIndex, setDraggedIndex] = useState<number | null>(null)
|
const [draggedIndex, setDraggedIndex] = useState<number | null>(null)
|
||||||
@@ -2428,7 +2429,14 @@ export function ToolInput({
|
|||||||
})()}
|
})()}
|
||||||
{(tool.type === 'workflow' || tool.type === 'workflow_input') &&
|
{(tool.type === 'workflow' || tool.type === 'workflow_input') &&
|
||||||
tool.params?.workflowId && (
|
tool.params?.workflowId && (
|
||||||
<WorkflowToolDeployBadge workflowId={tool.params.workflowId} />
|
<WorkflowToolDeployBadge
|
||||||
|
workflowId={tool.params.workflowId}
|
||||||
|
onDeploySuccess={() => {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ['workflow-input-fields', tool.params?.workflowId],
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className='flex flex-shrink-0 items-center gap-[8px]'>
|
<div className='flex flex-shrink-0 items-center gap-[8px]'>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import { createLogger } from '@sim/logger'
|
import { createLogger } from '@sim/logger'
|
||||||
|
import { useQueryClient } from '@tanstack/react-query'
|
||||||
import { useParams } from 'next/navigation'
|
import { useParams } from 'next/navigation'
|
||||||
import { Handle, type NodeProps, Position, useUpdateNodeInternals } from 'reactflow'
|
import { Handle, type NodeProps, Position, useUpdateNodeInternals } from 'reactflow'
|
||||||
import { Badge, Tooltip } from '@/components/emcn'
|
import { Badge, Tooltip } from '@/components/emcn'
|
||||||
@@ -528,6 +529,7 @@ export const WorkflowBlock = memo(function WorkflowBlock({
|
|||||||
const params = useParams()
|
const params = useParams()
|
||||||
const currentWorkflowId = params.workflowId as string
|
const currentWorkflowId = params.workflowId as string
|
||||||
const workspaceId = params.workspaceId as string
|
const workspaceId = params.workspaceId as string
|
||||||
|
const queryClient = useQueryClient()
|
||||||
|
|
||||||
const {
|
const {
|
||||||
currentWorkflow,
|
currentWorkflow,
|
||||||
@@ -600,6 +602,10 @@ export const WorkflowBlock = memo(function WorkflowBlock({
|
|||||||
responseData.apiKey || ''
|
responseData.apiKey || ''
|
||||||
)
|
)
|
||||||
refetchDeployment()
|
refetchDeployment()
|
||||||
|
// Invalidate the workflow schema cache so new config is loaded immediately
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ['workflow-input-fields', workflowId],
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
logger.error('Failed to deploy workflow')
|
logger.error('Failed to deploy workflow')
|
||||||
}
|
}
|
||||||
@@ -609,7 +615,7 @@ export const WorkflowBlock = memo(function WorkflowBlock({
|
|||||||
setIsDeploying(false)
|
setIsDeploying(false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[isDeploying, setDeploymentStatus, refetchDeployment]
|
[isDeploying, setDeploymentStatus, refetchDeployment, queryClient]
|
||||||
)
|
)
|
||||||
|
|
||||||
const currentStoreBlock = currentWorkflow.getBlockById(id)
|
const currentStoreBlock = currentWorkflow.getBlockById(id)
|
||||||
|
|||||||
Reference in New Issue
Block a user