@@ -20,11 +20,9 @@ import Title from '../card/base/title'
20
20
import Action from './action'
21
21
import cn from '@/utils/classnames'
22
22
import { API_PREFIX , MARKETPLACE_URL_PREFIX } from '@/config'
23
- import { useInvalidateInstalledPluginList } from '@/service/use-plugins'
24
- import { useInvalidateAllBuiltInTools , useInvalidateAllToolProviders } from '@/service/use-tools'
25
23
import { useSingleCategories } from '../hooks'
26
- import { useProviderContext } from '@/context/provider-context'
27
24
import { useRenderI18nObject } from '@/hooks/use-i18n'
25
+ import useRefreshPluginList from '@/app/components/plugins/install-plugin/hooks/use-refresh-plugin-list'
28
26
29
27
type Props = {
30
28
className ?: string
@@ -39,10 +37,7 @@ const PluginItem: FC<Props> = ({
39
37
const { categoriesMap } = useSingleCategories ( )
40
38
const currentPluginID = usePluginPageContext ( v => v . currentPluginID )
41
39
const setCurrentPluginID = usePluginPageContext ( v => v . setCurrentPluginID )
42
- const invalidateInstalledPluginList = useInvalidateInstalledPluginList ( )
43
- const invalidateAllToolProviders = useInvalidateAllToolProviders ( )
44
- const invalidateAllBuiltinTools = useInvalidateAllBuiltInTools ( )
45
- const { refreshModelProviders } = useProviderContext ( )
40
+ const { refreshPluginList } = useRefreshPluginList ( )
46
41
47
42
const {
48
43
source,
@@ -60,13 +55,7 @@ const PluginItem: FC<Props> = ({
60
55
} , [ source , author ] )
61
56
62
57
const handleDelete = ( ) => {
63
- invalidateInstalledPluginList ( )
64
- if ( PluginType . model . includes ( category ) )
65
- refreshModelProviders ( )
66
- if ( PluginType . tool . includes ( category ) ) {
67
- invalidateAllToolProviders ( )
68
- invalidateAllBuiltinTools ( )
69
- }
58
+ refreshPluginList ( { category } as any )
70
59
}
71
60
const getValueFromI18nObject = useRenderI18nObject ( )
72
61
const title = getValueFromI18nObject ( label )
@@ -116,6 +105,7 @@ const PluginItem: FC<Props> = ({
116
105
isShowDelete
117
106
meta = { meta }
118
107
onDelete = { handleDelete }
108
+ category = { category }
119
109
/>
120
110
</ div >
121
111
</ div >
0 commit comments