Skip to content

Commit 2e69f85

Browse files
TheodoreSpeaksTheodore Li
andauthored
Fix "fix in copilot" button (#3931)
* Fix "fix in copilot" button * Auto send message to copilot for fix in copilot --------- Co-authored-by: Theodore Li <theo@sim.ai>
1 parent 57e5bac commit 2e69f85

File tree

1 file changed

+11
-0
lines changed
  • apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel

1 file changed

+11
-0
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,17 @@ export const Panel = memo(function Panel({ workspaceId: propWorkspaceId }: Panel
411411
setHasHydrated(true)
412412
}, [setHasHydrated])
413413

414+
useEffect(() => {
415+
const handler = (e: Event) => {
416+
const message = (e as CustomEvent<{ message: string }>).detail?.message
417+
if (!message) return
418+
setActiveTab('copilot')
419+
copilotSendMessage(message)
420+
}
421+
window.addEventListener('mothership-send-message', handler)
422+
return () => window.removeEventListener('mothership-send-message', handler)
423+
}, [setActiveTab, copilotSendMessage])
424+
414425
/**
415426
* Handles tab click events
416427
*/

0 commit comments

Comments
 (0)