mirror of
https://github.com/langgenius/dify.git
synced 2026-01-19 11:45:05 +08:00
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:
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user