Merge branch 'chore/infrastructure-upgrade2' of github.com:langgenius/dify into chore/infrastructure-upgrade2

This commit is contained in:
NFish 2025-03-19 16:17:22 +08:00
commit 8012b092ce
12 changed files with 38 additions and 29 deletions

View File

@ -31,7 +31,7 @@ type IPagination = IUsePagination & {
} }
type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & { type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
as?: React.ReactElement as?: React.ReactNode
children?: string | React.ReactNode children?: string | React.ReactNode
className?: string className?: string
dataTestId?: string dataTestId?: string
@ -39,9 +39,9 @@ type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
type PageButtonProps = ButtonProps & { type PageButtonProps = ButtonProps & {
/** /**
* Provide a custom ReactElement (e.g. Next/Link) * Provide a custom ReactNode (e.g. Next/Link)
*/ */
as?: React.ReactElement as?: React.ReactNode
activeClassName?: string activeClassName?: string
inactiveClassName?: string inactiveClassName?: string
dataTestIdActive?: string dataTestIdActive?: string

View File

@ -9,7 +9,7 @@ export type HtmlContentProps = {
type IPopover = { type IPopover = {
className?: string className?: string
htmlContent: React.ReactElement<HtmlContentProps> htmlContent: React.ReactNode<HtmlContentProps>
popupClassName?: string popupClassName?: string
trigger?: 'click' | 'hover' trigger?: 'click' | 'hover'
position?: 'bottom' | 'br' | 'bl' position?: 'bottom' | 'br' | 'bl'
@ -99,7 +99,7 @@ export default function CustomPopover({
}) })
} }
> >
{cloneElement(htmlContent as React.ReactElement<HtmlContentProps>, { {cloneElement(htmlContent as React.ReactNode<HtmlContentProps>, {
onClose: () => onMouseLeave(open), onClose: () => onMouseLeave(open),
...(manualClose ...(manualClose
? { ? {

View File

@ -1,10 +1,10 @@
import type { ReactElement } from 'react' import type { ReactNode } from 'react'
import RadioGroupContext from '../../context' import RadioGroupContext from '../../context'
import s from '../../style.module.css' import s from '../../style.module.css'
import cn from '@/utils/classnames' import cn from '@/utils/classnames'
export type TRadioGroupProps = { export type TRadioGroupProps = {
children?: ReactElement | ReactElement[] children?: ReactNode | ReactNode[]
value?: string | number value?: string | number
className?: string className?: string
onChange?: (value: any) => void onChange?: (value: any) => void

View File

@ -1,4 +1,4 @@
import type { ReactElement } from 'react' import type { ReactNode } from 'react'
import { useId } from 'react' import { useId } from 'react'
import { useContext } from 'use-context-selector' import { useContext } from 'use-context-selector'
import RadioGroupContext from '../../context' import RadioGroupContext from '../../context'
@ -8,7 +8,7 @@ import cn from '@/utils/classnames'
export type IRadioProps = { export type IRadioProps = {
className?: string className?: string
labelClassName?: string labelClassName?: string
children?: string | ReactElement children?: string | ReactNode
checked?: boolean checked?: boolean
value?: string | number value?: string | number
disabled?: boolean disabled?: boolean

View File

@ -45,7 +45,7 @@ Object.defineProperty(globalThis, 'sessionStorage', {
const BrowserInitor = ({ const BrowserInitor = ({
children, children,
}: { children: React.ReactElement }) => { }: { children: React.ReactNode }) => {
return children return children
} }

View File

@ -24,7 +24,7 @@ const languageNames = {
} as { [key: string]: string } } as { [key: string]: string }
type IChildrenProps = { type IChildrenProps = {
children: React.ReactElement children: React.ReactNode
[key: string]: any [key: string]: any
} }
@ -122,7 +122,7 @@ function CodePanelHeader({ tag, label }: { tag: string; label: string }) {
} }
type ICodePanelProps = { type ICodePanelProps = {
children: React.ReactElement children: React.ReactNode
tag?: string tag?: string
code?: string code?: string
label?: string label?: string
@ -182,7 +182,7 @@ function CodeGroupHeader({ title, children, selectedIndex }: IChildrenProps) {
} }
type ICodeGroupPanelsProps = { type ICodeGroupPanelsProps = {
children: React.ReactElement children: React.ReactNode
[key: string]: any [key: string]: any
} }
function CodeGroupPanels({ children, targetCode, ...props }: ICodeGroupPanelsProps) { function CodeGroupPanels({ children, targetCode, ...props }: ICodeGroupPanelsProps) {

View File

@ -7,7 +7,7 @@ const isDevelopment = process.env.NODE_ENV === 'development'
const SentryInit = ({ const SentryInit = ({
children, children,
}: { children: React.ReactElement }) => { }: { children: React.ReactNode }) => {
useEffect(() => { useEffect(() => {
const SENTRY_DSN = document?.body?.getAttribute('data-public-sentry-dsn') const SENTRY_DSN = document?.body?.getAttribute('data-public-sentry-dsn')
if (!isDevelopment && SENTRY_DSN) { if (!isDevelopment && SENTRY_DSN) {

View File

@ -1,6 +1,6 @@
import type { import type {
FC, FC,
ReactElement, ReactNode,
} from 'react' } from 'react'
import { import {
cloneElement, cloneElement,
@ -46,7 +46,7 @@ import BlockIcon from '@/app/components/workflow/block-icon'
import Tooltip from '@/app/components/base/tooltip' import Tooltip from '@/app/components/base/tooltip'
type BaseNodeProps = { type BaseNodeProps = {
children: ReactElement children: ReactNode
} & NodeProps } & NodeProps
const BaseNode: FC<BaseNodeProps> = ({ const BaseNode: FC<BaseNodeProps> = ({

View File

@ -1,6 +1,6 @@
import type { import type {
FC, FC,
ReactElement, ReactNode,
} from 'react' } from 'react'
import { import {
cloneElement, cloneElement,
@ -48,7 +48,7 @@ import { useStore as useAppStore } from '@/app/components/app/store'
import { useStore } from '@/app/components/workflow/store' import { useStore } from '@/app/components/workflow/store'
type BasePanelProps = { type BasePanelProps = {
children: ReactElement children: ReactNode
} & Node } & Node
const BasePanel: FC<BasePanelProps> = ({ const BasePanel: FC<BasePanelProps> = ({

View File

@ -40,8 +40,8 @@ export const getLocaleOnServer = async (): Promise<Locale> => {
if (!languages.length) { if (!languages.length) {
// Negotiator expects plain object so we need to transform headers // Negotiator expects plain object so we need to transform headers
const negotiatorHeaders: Record<string, string> = {} const negotiatorHeaders: Record<string, string> = {};
headers().forEach((value, key) => (negotiatorHeaders[key] = value)) (await headers()).forEach((value, key) => (negotiatorHeaders[key] = value))
// Use negotiator and intl-localematcher to get best locale // Use negotiator and intl-localematcher to get best locale
languages = new Negotiator({ headers: negotiatorHeaders }).languages() languages = new Negotiator({ headers: negotiatorHeaders }).languages()
} }

View File

@ -121,7 +121,7 @@
"sharp": "^0.33.2", "sharp": "^0.33.2",
"shave": "^5.0.4", "shave": "^5.0.4",
"sortablejs": "^1.15.0", "sortablejs": "^1.15.0",
"swr": "^2.1.0", "swr": "^2.3.0",
"tailwind-merge": "^2.5.4", "tailwind-merge": "^2.5.4",
"use-context-selector": "^2.0.0", "use-context-selector": "^2.0.0",
"uuid": "^10.0.0", "uuid": "^10.0.0",

View File

@ -305,8 +305,8 @@ importers:
specifier: ^1.15.0 specifier: ^1.15.0
version: 1.15.3 version: 1.15.3
swr: swr:
specifier: ^2.1.0 specifier: ^2.3.0
version: 2.2.5(react@19.0.0) version: 2.3.3(react@19.0.0)
tailwind-merge: tailwind-merge:
specifier: ^2.5.4 specifier: ^2.5.4
version: 2.5.4 version: 2.5.4
@ -7516,10 +7516,10 @@ packages:
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
swr@2.2.5: swr@2.3.3:
resolution: {integrity: sha512-QtxqyclFeAsxEUeZIYmsaQ0UjimSq1RZ9Un7I68/0ClKK/U3LoyQunwkQfJZr2fc22DfIXLNDc2wFyTEikCUpg==} resolution: {integrity: sha512-dshNvs3ExOqtZ6kJBaAsabhPdHyeY4P2cKwRCniDVifBMoG/SVI7tfLWqPXriVspf2Rg4tPzXJTnwaihIeFw2A==}
peerDependencies: peerDependencies:
react: ^16.11.0 || ^17.0.0 || ^18.0.0 react: ^16.11.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
symbol-tree@3.2.4: symbol-tree@3.2.4:
resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==}
@ -7872,6 +7872,11 @@ packages:
peerDependencies: peerDependencies:
react: ^16.8.0 || ^17.0.0 || ^18.0.0 react: ^16.8.0 || ^17.0.0 || ^18.0.0
use-sync-external-store@1.4.0:
resolution: {integrity: sha512-9WXSPC5fMv61vaupRkCKCxsPxBocVnwakBEkMIHHpkTTg6icbJtg6jzgtLDm4bl3cSHAca52rYWih0k4K3PfHw==}
peerDependencies:
react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
util-deprecate@1.0.2: util-deprecate@1.0.2:
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
@ -17089,11 +17094,11 @@ snapshots:
supports-preserve-symlinks-flag@1.0.0: {} supports-preserve-symlinks-flag@1.0.0: {}
swr@2.2.5(react@19.0.0): swr@2.3.3(react@19.0.0):
dependencies: dependencies:
client-only: 0.0.1 dequal: 2.0.3
react: 19.0.0 react: 19.0.0
use-sync-external-store: 1.2.2(react@19.0.0) use-sync-external-store: 1.4.0(react@19.0.0)
symbol-tree@3.2.4: {} symbol-tree@3.2.4: {}
@ -17463,6 +17468,10 @@ snapshots:
dependencies: dependencies:
react: 19.0.0 react: 19.0.0
use-sync-external-store@1.4.0(react@19.0.0):
dependencies:
react: 19.0.0
util-deprecate@1.0.2: {} util-deprecate@1.0.2: {}
util@0.12.5: util@0.12.5: