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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix(publisher): enhance confirm dialog handling and improve popup interactions (#35701)
Coding On Stare751ec323eed
diff --git a/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/__tests__/index.spec.tsx b/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/__tests__/index.spec.tsxindex afd7c04ed12..cc2f96aa6ef 100644--- a/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/__tests__/index.spec.tsx+++ b/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/__tests__/index.spec.tsx@@ -330,6 +330,27 @@ describe('publisher', () => {})expect(mockSetShowPricingModal).toHaveBeenCalled()})++ it('should keep confirm dialog mounted when first publish opens follow-up overlay', async () => {+ mockPublishedAt.mockReturnValue(null)+ renderWithQueryClient(<Publisher />)++ fireEvent.click(screen.getByText('workflow.common.publish'))++ await waitFor(() => {+ expect(screen.getByText('workflow.common.publishUpdate')).toBeInTheDocument()+ })++ fireEvent.click(screen.getByRole('button', { name: /workflow.common.publishUpdate/i }))++ await waitFor(() => {+ expect(screen.getByText('pipeline.common.confirmPublish')).toBeInTheDocument()+ })++ fireEvent.mouseDown(document.body)++ expect(screen.getByText('pipeline.common.confirmPublish')).toBeInTheDocument()+ })})})diff --git a/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/index.tsx b/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/index.tsxindex 649b06ebcac..1d2ef242f8b 100644--- a/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/index.tsx+++ b/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/index.tsx@@ -1,6 +1,8 @@import { Button } from '@langgenius/dify-ui/button'+import { cn } from '@langgenius/dify-ui/cn'import { Popover, PopoverContent, PopoverTrigger } from '@langgenius/dify-ui/popover'import { RiArrowDownSLine } from '@remixicon/react'+import { useBoolean } from 'ahooks'import {memo,useCallback,@@ -13,13 +15,19 @@ import Popup from './popup'const Publisher = () => {const { t } = useTranslation()const [open, setOpen] = useState(false)+ const [confirmVisible, { setFalse: hideConfirm, setTrue: showConfirm }] = useBoolean(false)const { handleSyncWorkflowDraft } = useNodesSyncDraft()const handleOpenChange = useCallback((newOpen: boolean) => {+ if (!newOpen && confirmVisible)+ returnif (newOpen)handleSyncWorkflowDraft(true)setOpen(newOpen)- }, [handleSyncWorkflowDraft])+ }, [confirmVisible, handleSyncWorkflowDraft])+ const closePopover = useCallback(() => {+ setOpen(false)+ }, [])return (<Popover@@ -42,9 +50,14 @@ const Publisher = () => {placement="bottom-end"sideOffset={4}alignOffset={40}- popupClassName="border-none bg-transparent shadow-none"+ popupClassName={cn('border-none bg-transparent shadow-none', confirmVisible && 'hidden')}>- <Popup onRequestClose={() => handleOpenChange(false)} />+ <Popup+ onRequestClose={closePopover}+ confirmVisible={confirmVisible}+ onShowConfirm={showConfirm}+ onHideConfirm={hideConfirm}+ /></PopoverContent></Popover>)diff --git a/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/popup.tsx b/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/popup.tsxindex 31f59570295..0970d66cfcc 100644--- a/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/popup.tsx+++ b/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/popup.tsx@@ -41,9 +41,17 @@ import PublishAsKnowledgePipelineModal from '../../publish-as-knowledge-pipelineconst PUBLISH_SHORTCUT = ['ctrl', '⇧', 'P']type PopupProps = {onRequestClose?: () => void+ confirmVisible?: boolean+ onShowConfirm?: () => void+ onHideConfirm?: () => void}-const Popup = ({ onRequestClose }: PopupProps) => {+const Popup = ({+ onRequestClose,+ confirmVisible: controlledConfirmVisible,+ onShowConfirm,+ onHideConfirm,+}: PopupProps) => {const { t } = useTranslation()const { datasetId } = useParams()const { push } = useRouter()@@ -60,24 +68,32 @@ const Popup = ({ onRequestClose }: PopupProps) => {const isAllowPublishAsCustomKnowledgePipelineTemplate = useProviderContextSelector(s => s.isAllowPublishAsCustomKnowledgePipelineTemplate)const setShowPricingModal = useModalContextSelector(s => s.setShowPricingModal)const apiReferenceUrl = useDatasetApiAccessUrl()- const [confirmVisible, { setFalse: hideConfirm, setTrue: showConfirm }] = useBoolean(false)+ const [localConfirmVisible, { setFalse: hideLocalConfirm, setTrue: showLocalConfirm }] = useBoolean(false)+ const confirmVisible = controlledConfirmVisible ?? localConfirmVisible+ const showConfirm = onShowConfirm ?? showLocalConfirm+ const hideConfirm = onHideConfirm ?? hideLocalConfirmconst [publishing, { setFalse: hidePublishing, setTrue: showPublishing }] = useBoolean(false)const { mutateAsync: publishAsCustomizedPipeline } = usePublishAsCustomizedPipeline()const [showPublishAsKnowledgePipelineModal, { setFalse: hidePublishAsKnowledgePipelineModal, setTrue: setShowPublishAsKnowledgePipelineModal }] = useBoolean(false)const [isPublishingAsCustomizedPipeline, { setFalse: hidePublishingAsCustomizedPipeline, setTrue: showPublishingAsCustomizedPipeline }] = useBoolean(false)const invalidPublishedPipelineInfo = useInvalid([...publishedPipelineInfoQueryKeyPrefix, pipelineId])const invalidDatasetList = useInvalidDatasetList()+ const handleHideConfirm = useCallback(() => {+ hideConfirm()+ onRequestClose?.()+ }, [hideConfirm, onRequestClose])const handlePublish = useCallback(async (params?: PublishWorkflowParams) => {if (publishing)return+ let startedPublishing = falsetry {const checked = await handleCheckBeforePublish()if (checked) {if (!publishedAt && !confirmVisible) {- onRequestClose?.()showConfirm()return}+ startedPublishing = trueshowPublishing()const res = await publishWorkflow({url: `/rag/pipelines/${pipelineId}/workflows/publish`,@@ -114,12 +130,12 @@ const Popup = ({ onRequestClose }: PopupProps) => {toast.error(t('publishPipeline.error.message', { ns: 'datasetPipeline' }))}finally {- if (publishing)+ if (startedPublishing)hidePublishing()if (confirmVisible)- hideConfirm()+ handleHideConfirm()}- }, [publishing, handleCheckBeforePublish, publishedAt, confirmVisible, showPublishing, publishWorkflow, pipelineId, datasetId, showConfirm, t, workflowStore, mutateDatasetRes, invalidPublishedPipelineInfo, invalidDatasetList, hidePublishing, hideConfirm, onRequestClose])+ }, [publishing, handleCheckBeforePublish, publishedAt, confirmVisible, showPublishing, publishWorkflow, pipelineId, datasetId, showConfirm, t, workflowStore, mutateDatasetRes, invalidPublishedPipelineInfo, invalidDatasetList, hidePublishing, handleHideConfirm])useKeyPress(`${getKeyboardKeyCodeBySystem('ctrl')}.shift.p`, (e) => {e.preventDefault()if (published)@@ -163,10 +179,12 @@ const Popup = ({ onRequestClose }: PopupProps) => {}, [showPublishingAsCustomizedPipeline, publishAsCustomizedPipeline, pipelineId, t, invalidCustomizedTemplateList, hidePublishingAsCustomizedPipeline, hidePublishAsKnowledgePipelineModal, docLink])const handleClickPublishAsKnowledgePipeline = useCallback(() => {onRequestClose?.()- if (!isAllowPublishAsCustomKnowledgePipelineTemplate)+ if (!isAllowPublishAsCustomKnowledgePipelineTemplate) {setShowPricingModal()- else+ }+ else {setShowPublishAsKnowledgePipelineModal()+ }}, [isAllowPublishAsCustomKnowledgePipelineTemplate, onRequestClose, setShowPublishAsKnowledgePipelineModal, setShowPricingModal])return (<div className={cn('rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-xl shadow-shadow-shadow-5', isAllowPublishAsCustomKnowledgePipelineTemplate ? 'w-[360px]' : 'w-[400px]')}>@@ -238,7 +256,7 @@ const Popup = ({ onRequestClose }: PopupProps) => {</div></Button></div>- <AlertDialog open={confirmVisible} onOpenChange={open => !open && hideConfirm()}>+ <AlertDialog open={confirmVisible} onOpenChange={open => !open && handleHideConfirm()}><AlertDialogContent><div className="flex flex-col gap-2 px-6 pt-6 pb-4"><AlertDialogTitle