File tree Expand file tree Collapse file tree
apps/sim/app/workspace/[workspaceId]/w/[workflowId] Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import dynamic from 'next/dynamic'
12import type { EdgeTypes , NodeTypes } from 'reactflow'
23import { SubflowNodeComponent } from '@/app/workspace/[workspaceId]/w/[workflowId]/components'
3- import { NoteBlock } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/note-block/note-block'
44import { WorkflowBlock } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block'
55import { WorkflowEdge } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-edge/workflow-edge'
66
7+ /**
8+ * Lazily loaded note node. Defined once at module scope so the {@link nodeTypes}
9+ * map stays referentially stable for ReactFlow. Loading it dynamically keeps its
10+ * heavy markdown dependencies (Streamdown, remark-breaks) off the editor's
11+ * critical path — they load only when a workflow actually contains a note block.
12+ * `ssr: false` is safe because the note node is canvas-only and never rendered
13+ * on the server.
14+ */
15+ const NoteBlock = dynamic (
16+ ( ) =>
17+ import ( '@/app/workspace/[workspaceId]/w/[workflowId]/components/note-block/note-block' ) . then (
18+ ( mod ) => mod . NoteBlock
19+ ) ,
20+ { ssr : false }
21+ )
22+
723/** Custom node types for ReactFlow. */
824export const nodeTypes : NodeTypes = {
925 workflowBlock : WorkflowBlock ,
You can’t perform that action at this time.
0 commit comments