소스 검색

fix(web): fix the issue where the detail drawer content does not te after editing custom tools (#19460)

tags/1.4.0
HyaCinth 5 달 전
부모
커밋
692f922fa4
No account linked to committer's email address
1개의 변경된 파일10개의 추가작업 그리고 7개의 파일을 삭제
  1. 10
    7
      web/app/components/tools/provider-list.tsx

+ 10
- 7
web/app/components/tools/provider-list.tsx 파일 보기

}) })
}, [activeTab, tagFilterValue, keywords, collectionList]) }, [activeTab, tagFilterValue, keywords, collectionList])


const [currentProvider, setCurrentProvider] = useState<Collection | undefined>()
const [currentProviderId, setCurrentProviderId] = useState<string | undefined>()
const currentProvider = useMemo<Collection | undefined>(() => {
return filteredCollectionList.find(collection => collection.id === currentProviderId)
}, [currentProviderId, filteredCollectionList])
const { data: pluginList } = useInstalledPluginList() const { data: pluginList } = useInstalledPluginList()
const invalidateInstalledPluginList = useInvalidateInstalledPluginList() const invalidateInstalledPluginList = useInvalidateInstalledPluginList()
const currentPluginDetail = useMemo(() => { const currentPluginDetail = useMemo(() => {
> >
<div className={cn( <div className={cn(
'sticky top-0 z-20 flex flex-wrap items-center justify-between gap-y-2 bg-background-body px-12 pb-2 pt-4 leading-[56px]', 'sticky top-0 z-20 flex flex-wrap items-center justify-between gap-y-2 bg-background-body px-12 pb-2 pt-4 leading-[56px]',
currentProvider && 'pr-6',
currentProviderId && 'pr-6',
)}> )}>
<TabSliderNew <TabSliderNew
value={activeTab} value={activeTab}
onChange={(state) => { onChange={(state) => {
setActiveTab(state) setActiveTab(state)
if (state !== activeTab) if (state !== activeTab)
setCurrentProvider(undefined)
setCurrentProviderId(undefined)
}} }}
options={options} options={options}
/> />
{filteredCollectionList.map(collection => ( {filteredCollectionList.map(collection => (
<div <div
key={collection.id} key={collection.id}
onClick={() => setCurrentProvider(collection)}
onClick={() => setCurrentProviderId(collection.id)}
> >
<Card <Card
className={cn( className={cn(
'cursor-pointer border-[1.5px] border-transparent', 'cursor-pointer border-[1.5px] border-transparent',
currentProvider?.id === collection.id && 'border-components-option-card-option-selected-border',
currentProviderId === collection.id && 'border-components-option-card-option-selected-border',
)} )}
hideCornerMark hideCornerMark
payload={{ payload={{
{currentProvider && !currentProvider.plugin_id && ( {currentProvider && !currentProvider.plugin_id && (
<ProviderDetail <ProviderDetail
collection={currentProvider} collection={currentProvider}
onHide={() => setCurrentProvider(undefined)}
onHide={() => setCurrentProviderId(undefined)}
onRefreshData={refetch} onRefreshData={refetch}
/> />
)} )}
<PluginDetailPanel <PluginDetailPanel
detail={currentPluginDetail} detail={currentPluginDetail}
onUpdate={() => invalidateInstalledPluginList()} onUpdate={() => invalidateInstalledPluginList()}
onHide={() => setCurrentProvider(undefined)}
onHide={() => setCurrentProviderId(undefined)}
/> />
</> </>
) )

Loading…
취소
저장