mirror of
https://github.com/langgenius/dify.git
synced 2026-04-25 17:47:30 +08:00
feat(trigger): remove Redundant comp & triggers api no cache
This commit is contained in:
parent
d478f62b49
commit
06d1a2e2fd
@ -9,7 +9,7 @@ import { useTranslation } from 'react-i18next'
|
|||||||
import type { BlockEnum, OnSelectBlock } from '../types'
|
import type { BlockEnum, OnSelectBlock } from '../types'
|
||||||
import type { TriggerDefaultValue } from './types'
|
import type { TriggerDefaultValue } from './types'
|
||||||
import StartBlocks from './start-blocks'
|
import StartBlocks from './start-blocks'
|
||||||
import TriggerPluginSelector from './trigger-plugin-selector'
|
import TriggerPluginList from './trigger-plugin/list'
|
||||||
import { ENTRY_NODE_TYPES } from './constants'
|
import { ENTRY_NODE_TYPES } from './constants'
|
||||||
import cn from '@/utils/classnames'
|
import cn from '@/utils/classnames'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
@ -76,7 +76,7 @@ const AllStartBlocks = ({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{enableTriggerPlugin && (
|
{enableTriggerPlugin && (
|
||||||
<TriggerPluginSelector
|
<TriggerPluginList
|
||||||
onSelect={onSelect}
|
onSelect={onSelect}
|
||||||
searchText={searchText}
|
searchText={searchText}
|
||||||
onContentStateChange={handlePluginContentChange}
|
onContentStateChange={handlePluginContentChange}
|
||||||
|
|||||||
@ -1,30 +0,0 @@
|
|||||||
'use client'
|
|
||||||
import { memo } from 'react'
|
|
||||||
import TriggerPluginList from './trigger-plugin/list'
|
|
||||||
import type { BlockEnum } from '../types'
|
|
||||||
import type { TriggerDefaultValue } from './types'
|
|
||||||
|
|
||||||
type TriggerPluginSelectorProps = {
|
|
||||||
onSelect: (type: BlockEnum, trigger?: TriggerDefaultValue) => void
|
|
||||||
searchText: string
|
|
||||||
onContentStateChange?: (hasContent: boolean) => void
|
|
||||||
tags?: string[]
|
|
||||||
}
|
|
||||||
|
|
||||||
const TriggerPluginSelector = ({
|
|
||||||
onSelect,
|
|
||||||
searchText,
|
|
||||||
onContentStateChange,
|
|
||||||
tags = [],
|
|
||||||
}: TriggerPluginSelectorProps) => {
|
|
||||||
return (
|
|
||||||
<TriggerPluginList
|
|
||||||
onSelect={onSelect}
|
|
||||||
searchText={searchText}
|
|
||||||
onContentStateChange={onContentStateChange}
|
|
||||||
tags={tags}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default memo(TriggerPluginSelector)
|
|
||||||
@ -76,6 +76,8 @@ export const useAllTriggerPlugins = (enabled = true) => {
|
|||||||
return response.map(convertToTriggerWithProvider)
|
return response.map(convertToTriggerWithProvider)
|
||||||
},
|
},
|
||||||
enabled,
|
enabled,
|
||||||
|
staleTime: 0,
|
||||||
|
gcTime: 0,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +103,8 @@ export const useTriggerProviderInfo = (provider: string, enabled = true) => {
|
|||||||
queryKey: [NAME_SPACE, 'provider-info', provider],
|
queryKey: [NAME_SPACE, 'provider-info', provider],
|
||||||
queryFn: () => get<TriggerProviderApiEntity>(`/workspaces/current/trigger-provider/${provider}/info`),
|
queryFn: () => get<TriggerProviderApiEntity>(`/workspaces/current/trigger-provider/${provider}/info`),
|
||||||
enabled: enabled && !!provider,
|
enabled: enabled && !!provider,
|
||||||
|
staleTime: 0,
|
||||||
|
gcTime: 0,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user