File tree Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { builtinPlugins } from '../builtin';
1111import { pluginManager } from '../manager' ;
1212import { PluginStoreItem } from './Item' ;
1313import { ManualInstall } from './ManualInstall' ;
14+ import _uniqBy from 'lodash/uniqBy' ;
1415
1516function usePluginStoreData ( ) {
1617 const { loading : loading1 , value : installedPluginList = [ ] } = useAsync (
@@ -48,14 +49,16 @@ export const PluginStore: React.FC = React.memo(() => {
4849 < Divider orientation = "left" > { t ( '已安装' ) } </ Divider >
4950
5051 < div className = "flex flex-wrap" >
51- { [ ...builtinPlugins , ...installedPluginList ] . map ( ( plugin ) => (
52- < PluginStoreItem
53- key = { plugin . name }
54- manifest = { plugin }
55- installed = { true }
56- builtin = { builtinPluginNameList . includes ( plugin . name ) }
57- />
58- ) ) }
52+ { _uniqBy ( [ ...builtinPlugins , ...installedPluginList ] , 'name' ) . map (
53+ ( plugin ) => (
54+ < PluginStoreItem
55+ key = { plugin . name }
56+ manifest = { plugin }
57+ installed = { true }
58+ builtin = { builtinPluginNameList . includes ( plugin . name ) }
59+ />
60+ )
61+ ) }
5962 </ div >
6063 </ PillTabPane >
6164
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import _once from 'lodash/once';
99import { builtinPlugins } from './builtin' ;
1010import { showPluginLoadError } from './showPluginLoadError' ;
1111import { injectTailchatGlobalValue } from '@/utils/global-helper' ;
12+ import _uniqBy from 'lodash/uniqBy' ;
1213
1314class PluginManager {
1415 /**
@@ -20,10 +21,10 @@ class PluginManager {
2021 * 初始化插件
2122 */
2223 initPlugins = _once ( async ( ) => {
23- const installedPlugins = [
24- ...builtinPlugins ,
25- ... ( await this . getInstalledPlugins ( ) ) ,
26- ] ;
24+ const installedPlugins = _uniqBy (
25+ [ ...builtinPlugins , ... ( await this . getInstalledPlugins ( ) ) ] ,
26+ 'name'
27+ ) ;
2728
2829 const plugins = installedPlugins . map ( ( { name, url } ) => ( {
2930 name,
You can’t perform that action at this time.
0 commit comments