refactor & perf: import { noop } from 'lodash-es' across web (#17439)

This commit is contained in:
yusheng chen
2025-04-06 17:56:08 +08:00
committed by GitHub
parent 7016ccef10
commit c05e03fc09
87 changed files with 271 additions and 184 deletions

View File

@@ -8,8 +8,8 @@ import { CodeLanguage } from '@/app/components/workflow/nodes/code/types'
import {
getFilesInLogs,
} from '@/app/components/base/file-uploader/utils'
import './style.css'
import { noop } from 'lodash-es'
// load file from local instead of cdn https://github.com/suren-atoyan/monaco-react/issues/482
loader.config({ paths: { vs: '/vs' } })
@@ -55,7 +55,7 @@ const DEFAULT_THEME = {
const CodeEditor: FC<Props> = ({
value = '',
placeholder = '',
onChange = () => { },
onChange = noop,
title = '',
headerRight,
language,

View File

@@ -8,6 +8,7 @@ import { FILE_EXTS } from '@/app/components/base/prompt-editor/constants'
import TagInput from '@/app/components/base/tag-input'
import Checkbox from '@/app/components/base/checkbox'
import { FileTypeIcon } from '@/app/components/base/file-uploader'
import { noop } from 'lodash-es'
type Props = {
type: SupportUploadFileTypes.image | SupportUploadFileTypes.document | SupportUploadFileTypes.audio | SupportUploadFileTypes.video | SupportUploadFileTypes.custom
@@ -22,7 +23,7 @@ const FileTypeItem: FC<Props> = ({
selected,
onToggle,
customFileTypes = [],
onCustomFileTypesChange = () => { },
onCustomFileTypesChange = noop,
}) => {
const { t } = useTranslation()

View File

@@ -12,6 +12,7 @@ import { BlockEnum } from '@/app/components/workflow/types'
import PromptEditor from '@/app/components/base/prompt-editor'
import { Variable02 } from '@/app/components/base/icons/src/vender/solid/development'
import Tooltip from '@/app/components/base/tooltip'
import { noop } from 'lodash-es'
type Props = {
instanceId?: string
@@ -68,7 +69,7 @@ const Editor: FC<Props> = ({
show: false,
selectable: false,
datasets: [],
onAddContext: () => { },
onAddContext: noop,
}}
historyBlock={{
show: false,
@@ -77,7 +78,7 @@ const Editor: FC<Props> = ({
user: 'Human',
assistant: 'Assistant',
},
onEditRole: () => { },
onEditRole: noop,
}}
queryBlock={{
show: false,

View File

@@ -37,6 +37,7 @@ import AddButton from '@/app/components/base/button/add-button'
import Badge from '@/app/components/base/badge'
import Tooltip from '@/app/components/base/tooltip'
import { isExceptionVariable } from '@/app/components/workflow/utils'
import { noop } from 'lodash-es'
const TRIGGER_DEFAULT_WIDTH = 227
@@ -73,7 +74,7 @@ const VarReferencePicker: FC<Props> = ({
className,
isShowNodeName = true,
value = [],
onOpen = () => { },
onOpen = noop,
onChange,
isSupportConstantValue,
defaultVarKindType = VarKindType.constant,
@@ -283,7 +284,7 @@ const VarReferencePicker: FC<Props> = ({
{isAddBtnTrigger
? (
<div>
<AddButton onClick={() => { }}></AddButton>
<AddButton onClick={noop}></AddButton>
</div>
)
: (<div ref={!isSupportConstantValue ? triggerRef : null} className={cn((open || isFocus) ? 'border-gray-300' : 'border-gray-100', 'group/wrap relative flex h-8 w-full items-center', !isSupportConstantValue && 'rounded-lg bg-components-input-bg-normal p-1', isInTable && 'border-none bg-transparent', readonly && 'bg-components-input-bg-disabled')}>