File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
apps/sim/app/workspace/[workspaceId]/home/hooks Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -657,15 +657,15 @@ export function useChat(
657657 : useWorkflowRegistry . getState ( ) . activeWorkflowId
658658 if ( targetWorkflowId ) {
659659 const meta = useWorkflowRegistry . getState ( ) . workflows [ targetWorkflowId ]
660- if (
661- addResource ( {
662- type : 'workflow' ,
663- id : targetWorkflowId ,
664- title : meta ?. name ?? 'Workflow' ,
665- } )
666- ) {
667- onResourceEventRef . current ?.( )
660+ const wasAdded = addResource ( {
661+ type : 'workflow' ,
662+ id : targetWorkflowId ,
663+ title : meta ?. name ?? 'Workflow' ,
664+ } )
665+ if ( ! wasAdded && activeResourceIdRef . current !== targetWorkflowId ) {
666+ setActiveResourceId ( targetWorkflowId )
668667 }
668+ onResourceEventRef . current ?.( )
669669 }
670670 executeRunToolOnClient ( id , name , args as Record < string , unknown > )
671671 }
You can’t perform that action at this time.
0 commit comments