dify/web/app/components/workflow/workflow-generator/mount.tsx
Stephen Zhou a84c2d36a3
style: format with vp fmt (#38803)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-07-12 15:57:46 +00:00

22 lines
770 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