perf: lazy load SkillMain component using next/dynamic

Reduce initial bundle size by dynamically importing SkillMain
component. This prevents loading the entire Skill module (including
Monaco and Lexical editors) when users only access the Graph view.
This commit is contained in:
yyh
2026-01-16 21:31:56 +08:00
parent 721d82b91a
commit ad8c5f5452

View File

@ -2,6 +2,7 @@
import type { Features as FeaturesData } from '@/app/components/base/features/types'
import type { InjectWorkflowStoreSliceFn } from '@/app/components/workflow/store'
import dynamic from 'next/dynamic'
import { useSearchParams } from 'next/navigation'
import { useQueryState } from 'nuqs'
import {
@ -17,7 +18,6 @@ import WorkflowWithDefaultContext from '@/app/components/workflow'
import {
WorkflowContextProvider,
} from '@/app/components/workflow/context'
import SkillMain from '@/app/components/workflow/skill/main'
import { useWorkflowStore } from '@/app/components/workflow/store'
import { useTriggerStatusStore } from '@/app/components/workflow/store/trigger-status'
import {
@ -41,6 +41,10 @@ import {
import { parseAsViewType, WORKFLOW_VIEW_PARAM_KEY } from './search-params'
import { createWorkflowSlice } from './store/workflow/workflow-slice'
const SkillMain = dynamic(() => import('@/app/components/workflow/skill/main'), {
ssr: false,
})
const WorkflowAppWithAdditionalContext = () => {
const {
data,