mirror of
https://github.com/langgenius/dify.git
synced 2026-04-30 15:38:08 +08:00
fix(web): invalidate plugin checkInstalled cache after version updates
This commit is contained in:
@ -47,6 +47,7 @@ import { useInvalidateAllBuiltInTools } from './use-tools'
|
||||
const NAME_SPACE = 'plugins'
|
||||
|
||||
const useInstalledPluginListKey = [NAME_SPACE, 'installedPluginList']
|
||||
const useCheckInstalledKey = [NAME_SPACE, 'checkInstalled'] as const
|
||||
export const useCheckInstalled = ({
|
||||
pluginIds,
|
||||
enabled,
|
||||
@ -55,7 +56,7 @@ export const useCheckInstalled = ({
|
||||
enabled: boolean
|
||||
}) => {
|
||||
return useQuery<{ plugins: PluginDetail[] }>({
|
||||
queryKey: [NAME_SPACE, 'checkInstalled', pluginIds],
|
||||
queryKey: [...useCheckInstalledKey, pluginIds],
|
||||
queryFn: () => post<{ plugins: PluginDetail[] }>('/workspaces/current/plugin/list/installations/ids', {
|
||||
body: {
|
||||
plugin_ids: pluginIds,
|
||||
@ -66,6 +67,17 @@ export const useCheckInstalled = ({
|
||||
})
|
||||
}
|
||||
|
||||
export const useInvalidateCheckInstalled = () => {
|
||||
const queryClient = useQueryClient()
|
||||
return () => {
|
||||
queryClient.invalidateQueries(
|
||||
{
|
||||
queryKey: useCheckInstalledKey,
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const useRecommendedMarketplacePluginsKey = [NAME_SPACE, 'recommendedMarketplacePlugins']
|
||||
export const useRecommendedMarketplacePlugins = ({
|
||||
collection = '__recommended-plugins-tools',
|
||||
|
||||
Reference in New Issue
Block a user