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

This commit is contained in:
HyaCinth 2025-05-13 13:47:15 +08:00 committed by GitHub
parent 33d3bc276e
commit 692f922fa4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -53,7 +53,10 @@ const ProviderList = () => {
}) })
}, [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(() => {
@ -70,14 +73,14 @@ const ProviderList = () => {
> >
<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}
/> />
@ -102,12 +105,12 @@ const ProviderList = () => {
{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={{
@ -146,14 +149,14 @@ const ProviderList = () => {
{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)}
/> />
</> </>
) )