diff --git a/web/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-panel.tsx b/web/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-panel.tsx index 54fbfc75a9..d293be3aad 100644 --- a/web/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-panel.tsx +++ b/web/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-panel.tsx @@ -33,7 +33,7 @@ const AppInputsPanel = ({ const isBasicApp = appDetail.mode !== 'advanced-chat' && appDetail.mode !== 'workflow' const { data: fileUploadConfig } = useFileUploadConfig() const { data: currentApp, isFetching: isAppLoading } = useAppDetail(appDetail.id) - const { data: currentWorkflow, isFetching: isWorkflowLoading } = useAppWorkflow(isBasicApp ? 'empty' : appDetail.id) + const { data: currentWorkflow, isFetching: isWorkflowLoading } = useAppWorkflow(isBasicApp ? '' : appDetail.id) const isLoading = isAppLoading || isWorkflowLoading const basicAppFileConfig = useMemo(() => { diff --git a/web/service/use-workflow.ts b/web/service/use-workflow.ts index 9413854726..2b8e81b700 100644 --- a/web/service/use-workflow.ts +++ b/web/service/use-workflow.ts @@ -8,11 +8,8 @@ const NAME_SPACE = 'workflow' export const useAppWorkflow = (appID: string) => { return useQuery({ + enabled: !!appID, queryKey: [NAME_SPACE, 'publish', appID], - queryFn: () => { - if (appID === 'empty') - return Promise.resolve({} as unknown as FetchWorkflowDraftResponse) - return get(`/apps/${appID}/workflows/publish`) - }, + queryFn: () => get(`/apps/${appID}/workflows/publish`), }) }