dify/web/app/components/workflow/workflow-generator/mount.tsx
Crazywoola 0bfbd2061e
feat: enhance go to anything (#32130)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-04 11:06:17 +00:00

23 lines
772 B
TypeScript

'use client'
import * as React from 'react'
import dynamic from '@/next/dynamic'
import { useWorkflowGeneratorStore } from './store'
// Lazy-load the modal so the bundle of the common layout stays light;
// the modal is only mounted on demand when cmd+k `/create` fires.
const WorkflowGeneratorModal = dynamic(() => import('./index'), { ssr: false })
/**
* Global mount point for the workflow generator modal. Place once in the
* common layout next to ``<GotoAnything />`` — the modal opens whenever the
* zustand store flips ``isOpen`` to true.
*/
const WorkflowGeneratorMount: React.FC = () => {
const isOpen = useWorkflowGeneratorStore(s => s.isOpen)
if (!isOpen)
return null
return <WorkflowGeneratorModal />
}
export default WorkflowGeneratorMount