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,6 +8,7 @@ import CSVDownloader from './csv-downloader'
import Button from '@/app/components/base/button'
import Modal from '@/app/components/base/modal'
import type { ChunkingMode } from '@/models/datasets'
import { noop } from 'lodash-es'
export type IBatchModalProps = {
isShow: boolean
@@ -39,7 +40,7 @@ const BatchModal: FC<IBatchModalProps> = ({
}, [isShow])
return (
<Modal isShow={isShow} onClose={() => { }} className='!max-w-[520px] !rounded-xl px-8 py-6'>
<Modal isShow={isShow} onClose={noop} className='!max-w-[520px] !rounded-xl px-8 py-6'>
<div className='relative pb-1 text-xl font-medium leading-[30px] text-gray-900'>{t('datasetDocuments.list.batchModal.title')}</div>
<div className='absolute right-4 top-4 cursor-pointer p-2' onClick={onCancel}>
<RiCloseLine className='h-4 w-4 text-gray-500' />

View File

@@ -1,6 +1,7 @@
import React, { type FC } from 'react'
import Drawer from '@/app/components/base/drawer'
import classNames from '@/utils/classnames'
import { noop } from 'lodash-es'
type IFullScreenDrawerProps = {
isOpen: boolean
@@ -11,7 +12,7 @@ type IFullScreenDrawerProps = {
const FullScreenDrawer: FC<IFullScreenDrawerProps> = ({
isOpen,
onClose = () => {},
onClose = noop,
fullScreen,
children,
}) => {

View File

@@ -5,6 +5,7 @@ import { useCountDown } from 'ahooks'
import Modal from '@/app/components/base/modal'
import Button from '@/app/components/base/button'
import { useEventEmitterContextContext } from '@/context/event-emitter'
import { noop } from 'lodash-es'
type IDefaultContentProps = {
onCancel: () => void
@@ -120,7 +121,7 @@ const RegenerationModal: FC<IRegenerationModalProps> = ({
})
return (
<Modal isShow={isShow} onClose={() => {}} className='!max-w-[480px] !rounded-2xl'>
<Modal isShow={isShow} onClose={noop} className='!max-w-[480px] !rounded-2xl'>
{!loading && !updateSucceeded && <DefaultContent onCancel={onCancel} onConfirm={onConfirm} />}
{loading && !updateSucceeded && <RegeneratingContent />}
{!loading && updateSucceeded && <RegenerationCompletedContent onClose={onClose} />}

View File

@@ -46,6 +46,7 @@ import {
useUpdateSegment,
} from '@/service/knowledge/use-segment'
import { useInvalid } from '@/service/use-base'
import { noop } from 'lodash-es'
const DEFAULT_LIMIT = 10
@@ -71,7 +72,7 @@ type SegmentListContextValue = {
const SegmentListContext = createContext<SegmentListContextValue>({
isCollapsed: true,
fullScreen: false,
toggleFullScreen: () => {},
toggleFullScreen: noop,
currSegment: { showModal: false },
currChildChunk: { showModal: false },
})