feat(trigger): remove Redundant comp & triggers api no cache

This commit is contained in:
yessenia 2025-10-22 15:36:18 +08:00
parent d478f62b49
commit 06d1a2e2fd
3 changed files with 6 additions and 32 deletions

View File

@ -9,7 +9,7 @@ import { useTranslation } from 'react-i18next'
import type { BlockEnum, OnSelectBlock } from '../types'
import type { TriggerDefaultValue } from './types'
import StartBlocks from './start-blocks'
import TriggerPluginSelector from './trigger-plugin-selector'
import TriggerPluginList from './trigger-plugin/list'
import { ENTRY_NODE_TYPES } from './constants'
import cn from '@/utils/classnames'
import Link from 'next/link'
@ -76,7 +76,7 @@ const AllStartBlocks = ({
/>
{enableTriggerPlugin && (
<TriggerPluginSelector
<TriggerPluginList
onSelect={onSelect}
searchText={searchText}
onContentStateChange={handlePluginContentChange}

View File

@ -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)

View File

@ -76,6 +76,8 @@ export const useAllTriggerPlugins = (enabled = true) => {
return response.map(convertToTriggerWithProvider)
},
enabled,
staleTime: 0,
gcTime: 0,
})
}
@ -101,6 +103,8 @@ export const useTriggerProviderInfo = (provider: string, enabled = true) => {
queryKey: [NAME_SPACE, 'provider-info', provider],
queryFn: () => get<TriggerProviderApiEntity>(`/workspaces/current/trigger-provider/${provider}/info`),
enabled: enabled && !!provider,
staleTime: 0,
gcTime: 0,
})
}