From ad7fdd18d00afd8127467c32c6b11a37102845af Mon Sep 17 00:00:00 2001 From: Yessenia-d Date: Mon, 17 Nov 2025 17:19:35 +0800 Subject: [PATCH] fix: update currentTriggerPlugin check in BasePanel component (#28287) --- .../subscription-list/create/common-modal.tsx | 6 +++--- .../subscription-list/delete-confirm.tsx | 6 +++--- .../plugin-detail-panel/subscription-list/store.ts | 11 ----------- .../subscription-list/use-subscription-list.ts | 8 -------- .../nodes/_base/components/workflow-panel/index.tsx | 2 +- 5 files changed, 7 insertions(+), 26 deletions(-) delete mode 100644 web/app/components/plugins/plugin-detail-panel/subscription-list/store.ts diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx index 17a46febdf..3bd82d59c1 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx @@ -24,8 +24,8 @@ import { debounce } from 'lodash-es' import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import LogViewer from '../log-viewer' -import { usePluginSubscriptionStore } from '../store' import { usePluginStore } from '../../store' +import { useSubscriptionList } from '../use-subscription-list' type Props = { onClose: () => void @@ -91,7 +91,7 @@ const MultiSteps = ({ currentStep }: { currentStep: ApiKeyStep }) => { export const CommonCreateModal = ({ onClose, createType, builder }: Props) => { const { t } = useTranslation() const detail = usePluginStore(state => state.detail) - const { refresh } = usePluginSubscriptionStore() + const { refetch } = useSubscriptionList() const [currentStep, setCurrentStep] = useState(createType === SupportedCreationMethods.APIKEY ? ApiKeyStep.Verify : ApiKeyStep.Configuration) @@ -295,7 +295,7 @@ export const CommonCreateModal = ({ onClose, createType, builder }: Props) => { message: t('pluginTrigger.subscription.createSuccess'), }) onClose() - refresh?.() + refetch?.() }, onError: async (error: any) => { const errorMessage = await parsePluginErrorMessage(error) || t('pluginTrigger.subscription.createFailed') diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/delete-confirm.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/delete-confirm.tsx index 178983c6b1..5f4e8a2cbf 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/delete-confirm.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/delete-confirm.tsx @@ -4,7 +4,7 @@ import Toast from '@/app/components/base/toast' import { useDeleteTriggerSubscription } from '@/service/use-triggers' import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { usePluginSubscriptionStore } from './store' +import { useSubscriptionList } from './use-subscription-list' type Props = { onClose: (deleted: boolean) => void @@ -18,7 +18,7 @@ const tPrefix = 'pluginTrigger.subscription.list.item.actions.deleteConfirm' export const DeleteConfirm = (props: Props) => { const { onClose, isShow, currentId, currentName, workflowsInUse } = props - const { refresh } = usePluginSubscriptionStore() + const { refetch } = useSubscriptionList() const { mutate: deleteSubscription, isPending: isDeleting } = useDeleteTriggerSubscription() const { t } = useTranslation() const [inputName, setInputName] = useState('') @@ -40,7 +40,7 @@ export const DeleteConfirm = (props: Props) => { message: t(`${tPrefix}.success`, { name: currentName }), className: 'z-[10000001]', }) - refresh?.() + refetch?.() onClose(true) }, onError: (error: any) => { diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/store.ts b/web/app/components/plugins/plugin-detail-panel/subscription-list/store.ts deleted file mode 100644 index 24840e9971..0000000000 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/store.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { create } from 'zustand' - -type ShapeSubscription = { - refresh?: () => void - setRefresh: (refresh: () => void) => void -} - -export const usePluginSubscriptionStore = create(set => ({ - refresh: undefined, - setRefresh: (refresh: () => void) => set({ refresh }), -})) diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/use-subscription-list.ts b/web/app/components/plugins/plugin-detail-panel/subscription-list/use-subscription-list.ts index ff3e903a31..9f95ff05a0 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/use-subscription-list.ts +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/use-subscription-list.ts @@ -1,19 +1,11 @@ -import { useEffect } from 'react' import { useTriggerSubscriptions } from '@/service/use-triggers' import { usePluginStore } from '../store' -import { usePluginSubscriptionStore } from './store' export const useSubscriptionList = () => { const detail = usePluginStore(state => state.detail) - const { setRefresh } = usePluginSubscriptionStore() const { data: subscriptions, isLoading, refetch } = useTriggerSubscriptions(detail?.provider || '') - useEffect(() => { - if (refetch) - setRefresh(refetch) - }, [refetch, setRefresh]) - return { detail, subscriptions, diff --git a/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx b/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx index eaafab550e..bc33a05f58 100644 --- a/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx +++ b/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx @@ -298,7 +298,7 @@ const BasePanel: FC = ({ const { setDetail } = usePluginStore() useEffect(() => { - if (currentTriggerPlugin?.subscription_constructor) { + if (currentTriggerPlugin) { setDetail({ name: currentTriggerPlugin.label[language], plugin_id: currentTriggerPlugin.plugin_id || '',