diff --git a/web/app/components/plugins/plugin-detail-panel/index.tsx b/web/app/components/plugins/plugin-detail-panel/index.tsx index 8f8c2b58e7..afe926675f 100644 --- a/web/app/components/plugins/plugin-detail-panel/index.tsx +++ b/web/app/components/plugins/plugin-detail-panel/index.tsx @@ -33,13 +33,11 @@ const PluginDetailPanel: FC = ({ const { setDetail } = usePluginStore() useEffect(() => { - if (detail) { - setDetail({ - plugin_id: detail.plugin_id, - provider: `${detail.plugin_id}/${detail.declaration.name}`, - declaration: detail.declaration, - }) - } + setDetail(!detail ? undefined : { + plugin_id: detail.plugin_id, + provider: `${detail.plugin_id}/${detail.declaration.name}`, + declaration: detail.declaration, + }) }, [detail]) if (!detail) 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 index be02c5ba42..a7258b3c7d 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/store.ts +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/store.ts @@ -5,12 +5,12 @@ type SimpleDetail = Pick & { provider type Shape = { detail: SimpleDetail | undefined - setDetail: (detail: SimpleDetail) => void + setDetail: (detail?: SimpleDetail) => void } export const usePluginStore = create(set => ({ detail: undefined, - setDetail: (detail: SimpleDetail) => set({ detail }), + setDetail: (detail?: SimpleDetail) => set({ detail }), })) type ShapeSubscription = { diff --git a/web/app/components/plugins/plugin-detail-panel/trigger-events-list.tsx b/web/app/components/plugins/plugin-detail-panel/trigger-events-list.tsx index 684f043be9..75de19d968 100644 --- a/web/app/components/plugins/plugin-detail-panel/trigger-events-list.tsx +++ b/web/app/components/plugins/plugin-detail-panel/trigger-events-list.tsx @@ -84,13 +84,8 @@ export const TriggerEventsList = () => { const language = getLanguage(locale) const detail = usePluginStore(state => state.detail) const events = detail?.declaration.trigger?.events || [] - const providerKey = useMemo(() => { - if (!detail?.plugin_id || !detail?.declaration?.name) - return '' - return `${detail.plugin_id}/${detail.declaration.name}` - }, [detail?.plugin_id, detail?.declaration?.name]) - const { data: providerInfo } = useTriggerProviderInfo(providerKey, !!providerKey) + const { data: providerInfo } = useTriggerProviderInfo(detail?.provider || '') const collection = useMemo(() => { if (!detail || !providerInfo)