mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-12 12:26:54 +08:00
refactor & perf: import { noop } from 'lodash-es' across web (#17439)
This commit is contained in:
@@ -14,6 +14,7 @@ import { useSelector as useAppContextSelector } from '@/context/app-context'
|
||||
import type { FilterState } from './filter-management'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useTabSearchParams } from '@/hooks/use-tab-searchparams'
|
||||
import { noop } from 'lodash-es'
|
||||
|
||||
export type PluginPageContextValue = {
|
||||
containerRef: React.RefObject<HTMLDivElement>
|
||||
@@ -29,15 +30,15 @@ export type PluginPageContextValue = {
|
||||
export const PluginPageContext = createContext<PluginPageContextValue>({
|
||||
containerRef: { current: null },
|
||||
currentPluginID: undefined,
|
||||
setCurrentPluginID: () => { },
|
||||
setCurrentPluginID: noop,
|
||||
filters: {
|
||||
categories: [],
|
||||
tags: [],
|
||||
searchQuery: '',
|
||||
},
|
||||
setFilters: () => { },
|
||||
setFilters: noop,
|
||||
activeTab: '',
|
||||
setActiveTab: () => { },
|
||||
setActiveTab: noop,
|
||||
options: [],
|
||||
})
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import Line from '../../marketplace/empty/line'
|
||||
import { useInstalledPluginList } from '@/service/use-plugins'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { SUPPORT_INSTALL_LOCAL_FILE_EXTENSIONS } from '@/config'
|
||||
import { noop } from 'lodash-es'
|
||||
|
||||
const Empty = () => {
|
||||
const { t } = useTranslation()
|
||||
@@ -99,14 +100,14 @@ const Empty = () => {
|
||||
</div>
|
||||
</div>
|
||||
{selectedAction === 'github' && <InstallFromGitHub
|
||||
onSuccess={() => { }}
|
||||
onSuccess={noop}
|
||||
onClose={() => setSelectedAction(null)}
|
||||
/>}
|
||||
{selectedAction === 'local' && selectedFile
|
||||
&& (<InstallFromLocalPackage
|
||||
file={selectedFile}
|
||||
onClose={() => setSelectedAction(null)}
|
||||
onSuccess={() => { }}
|
||||
onSuccess={noop}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import { marketplaceApiPrefix } from '@/config'
|
||||
import { SUPPORT_INSTALL_LOCAL_FILE_EXTENSIONS } from '@/config'
|
||||
import { LanguagesSupported } from '@/i18n/language'
|
||||
import I18n from '@/context/i18n'
|
||||
import { noop } from 'lodash-es'
|
||||
|
||||
const PACKAGE_IDS_KEY = 'package-ids'
|
||||
const BUNDLE_INFO_KEY = 'bundle-info'
|
||||
@@ -230,8 +231,8 @@ const PluginPage = ({
|
||||
{currentFile && (
|
||||
<InstallFromLocalPackage
|
||||
file={currentFile}
|
||||
onClose={removeFile ?? (() => { })}
|
||||
onSuccess={() => { }}
|
||||
onClose={removeFile ?? noop}
|
||||
onSuccess={noop}
|
||||
/>
|
||||
)}
|
||||
<input
|
||||
@@ -240,7 +241,7 @@ const PluginPage = ({
|
||||
type="file"
|
||||
id="fileUploader"
|
||||
accept={SUPPORT_INSTALL_LOCAL_FILE_EXTENSIONS}
|
||||
onChange={fileChangeHandle ?? (() => { })}
|
||||
onChange={fileChangeHandle ?? noop}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
import { useSelector as useAppContextSelector } from '@/context/app-context'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { SUPPORT_INSTALL_LOCAL_FILE_EXTENSIONS } from '@/config'
|
||||
import { noop } from 'lodash-es'
|
||||
|
||||
type Props = {
|
||||
onSwitchToMarketplaceTab: () => void
|
||||
@@ -118,14 +119,14 @@ const InstallPluginDropdown = ({
|
||||
</PortalToFollowElemContent>
|
||||
</div>
|
||||
{selectedAction === 'github' && <InstallFromGitHub
|
||||
onSuccess={() => { }}
|
||||
onSuccess={noop}
|
||||
onClose={() => setSelectedAction(null)}
|
||||
/>}
|
||||
{selectedAction === 'local' && selectedFile
|
||||
&& (<InstallFromLocalPackage
|
||||
file={selectedFile}
|
||||
onClose={() => setSelectedAction(null)}
|
||||
onSuccess={() => { }}
|
||||
onSuccess={noop}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user