Skip to content

Commit d7f70f3

Browse files
authored
refactor: route low-cost next modules through compat re-exports (#33622)
1 parent bbe975c commit d7f70f3

File tree

34 files changed

+66
-33
lines changed

34 files changed

+66
-33
lines changed

web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
RiTerminalWindowLine,
1414
} from '@remixicon/react'
1515
import { useUnmount } from 'ahooks'
16-
import dynamic from 'next/dynamic'
1716
import { usePathname, useRouter } from 'next/navigation'
1817
import * as React from 'react'
1918
import { useCallback, useEffect, useState } from 'react'
@@ -26,6 +25,7 @@ import { useStore as useTagStore } from '@/app/components/base/tag-management/st
2625
import { useAppContext } from '@/context/app-context'
2726
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
2827
import useDocumentTitle from '@/hooks/use-document-title'
28+
import dynamic from '@/next/dynamic'
2929
import { fetchAppDetailDirect } from '@/service/apps'
3030
import { AppModeEnum } from '@/types/app'
3131
import { cn } from '@/utils/classnames'

web/app/components/app-sidebar/app-info/app-info-modals.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import type { DuplicateAppModalProps } from '@/app/components/app/duplicate-moda
33
import type { CreateAppModalProps } from '@/app/components/explore/create-app-modal'
44
import type { EnvironmentVariable } from '@/app/components/workflow/types'
55
import type { App, AppSSO } from '@/types/app'
6-
import dynamic from 'next/dynamic'
76
import * as React from 'react'
87
import { useTranslation } from 'react-i18next'
8+
import dynamic from '@/next/dynamic'
99

1010
const SwitchAppModal = dynamic(() => import('@/app/components/app/switch-app-modal'), { ssr: false })
1111
const CreateAppModal = dynamic(() => import('@/app/components/explore/create-app-modal'), { ssr: false })

web/app/components/apps/app-card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type { CreateAppModalProps } from '@/app/components/explore/create-app-mo
77
import type { EnvironmentVariable } from '@/app/components/workflow/types'
88
import type { App } from '@/types/app'
99
import { RiBuildingLine, RiGlobalLine, RiLockLine, RiMoreFill, RiVerifiedBadgeLine } from '@remixicon/react'
10-
import dynamic from 'next/dynamic'
1110
import { useRouter } from 'next/navigation'
1211
import * as React from 'react'
1312
import { useCallback, useEffect, useMemo, useState } from 'react'
@@ -36,6 +35,7 @@ import { useGlobalPublicStore } from '@/context/global-public-context'
3635
import { useProviderContext } from '@/context/provider-context'
3736
import { useAsyncWindowOpen } from '@/hooks/use-async-window-open'
3837
import { AccessMode } from '@/models/access-control'
38+
import dynamic from '@/next/dynamic'
3939
import { useGetUserCanAccessApp } from '@/service/access-control'
4040
import { copyApp, exportAppConfig, updateAppInfo } from '@/service/apps'
4141
import { fetchInstalledAppList } from '@/service/explore'

web/app/components/apps/list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import type { FC } from 'react'
44
import { useDebounceFn } from 'ahooks'
5-
import dynamic from 'next/dynamic'
65
import { parseAsStringLiteral, useQueryState } from 'nuqs'
76
import { useCallback, useEffect, useRef, useState } from 'react'
87
import { useTranslation } from 'react-i18next'
@@ -15,6 +14,7 @@ import { NEED_REFRESH_APP_LIST_KEY } from '@/config'
1514
import { useAppContext } from '@/context/app-context'
1615
import { useGlobalPublicStore } from '@/context/global-public-context'
1716
import { CheckModal } from '@/hooks/use-pay'
17+
import dynamic from '@/next/dynamic'
1818
import { useInfiniteAppList } from '@/service/use-apps'
1919
import { AppModeEnum, AppModes } from '@/types/app'
2020
import { cn } from '@/utils/classnames'

web/app/components/apps/new-app-card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use client'
22

3-
import dynamic from 'next/dynamic'
43
import {
54
useRouter,
65
useSearchParams,
@@ -13,6 +12,7 @@ import { CreateFromDSLModalTab } from '@/app/components/app/create-from-dsl-moda
1312
import { FileArrow01, FilePlus01, FilePlus02 } from '@/app/components/base/icons/src/vender/line/files'
1413
import AppListContext from '@/context/app-list-context'
1514
import { useProviderContext } from '@/context/provider-context'
15+
import dynamic from '@/next/dynamic'
1616
import { cn } from '@/utils/classnames'
1717

1818
const CreateAppModal = dynamic(() => import('@/app/components/app/create-app-modal'), {

web/app/components/base/file-uploader/dynamic-pdf-preview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import dynamic from 'next/dynamic'
3+
import dynamic from '@/next/dynamic'
44

55
type DynamicPdfPreviewProps = {
66
url: string

web/app/components/base/ga/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { FC } from 'react'
2-
import { headers } from 'next/headers'
3-
import Script from 'next/script'
42
import * as React from 'react'
53
import { IS_CE_EDITION, IS_PROD } from '@/config'
4+
import { headers } from '@/next/headers'
5+
import Script from '@/next/script'
66

77
export enum GaType {
88
admin = 'admin',

web/app/components/base/markdown-blocks/code-block.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import ReactEcharts from 'echarts-for-react'
2-
import dynamic from 'next/dynamic'
32
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
43
import SyntaxHighlighter from 'react-syntax-highlighter'
54
import {
@@ -12,6 +11,7 @@ import MarkdownMusic from '@/app/components/base/markdown-blocks/music'
1211
import ErrorBoundary from '@/app/components/base/markdown/error-boundary'
1312
import SVGBtn from '@/app/components/base/svg'
1413
import useTheme from '@/hooks/use-theme'
14+
import dynamic from '@/next/dynamic'
1515
import { Theme } from '@/types/app'
1616
import SVGRenderer from '../svg-gallery' // Assumes svg-gallery.tsx is in /base directory
1717

web/app/components/base/markdown/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { SimplePluginInfo, StreamdownWrapperProps } from './streamdown-wrapper'
22
import { flow } from 'es-toolkit/compat'
3-
import dynamic from 'next/dynamic'
43
import { memo, useMemo } from 'react'
4+
import dynamic from '@/next/dynamic'
55
import { cn } from '@/utils/classnames'
66
import { preprocessLaTeX, preprocessThinkTag } from './markdown-utils'
77

web/app/components/base/markdown/streamdown-wrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { ComponentType } from 'react'
22
import type { Components, StreamdownProps } from 'streamdown'
33
import { createMathPlugin } from '@streamdown/math'
4-
import dynamic from 'next/dynamic'
54
import { memo, useMemo } from 'react'
65
import RemarkBreaks from 'remark-breaks'
76
import { defaultRehypePlugins, defaultRemarkPlugins, Streamdown } from 'streamdown'
@@ -18,6 +17,7 @@ import {
1817
VideoBlock,
1918
} from '@/app/components/base/markdown-blocks'
2019
import { ENABLE_SINGLE_DOLLAR_LATEX } from '@/config'
20+
import dynamic from '@/next/dynamic'
2121
import { customUrlTransform } from './markdown-utils'
2222
import 'katex/dist/katex.min.css'
2323

0 commit comments

Comments
 (0)