Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: update currentTriggerPlugin check in BasePanel component (#28287)

Yessenia-dad7fdd18d00a
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 17a46febdfb..3bd82d59c1f 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<ApiKeyStep>(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 178983c6b1c..5f4e8a2cbf1 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 24840e99719..00000000000
--- 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<ShapeSubscription>(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 ff3e903a31f..9f95ff05a0b 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 eaafab550ee..bc33a05f586 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<BasePanelProps> = ({
const { setDetail } = usePluginStore()
useEffect(() => {
- if (currentTriggerPlugin?.subscription_constructor) {
+ if (currentTriggerPlugin) {
setDetail({
name: currentTriggerPlugin.label[language],
plugin_id: currentTriggerPlugin.plugin_id || '',