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.

refactor(web): remove redundant annotation list success toasts (#44031)

Codada7d3e96d9cb2b
diff --git a/web/app/components/app/annotation/__tests__/index.spec.tsx b/web/app/components/app/annotation/__tests__/index.spec.tsx
index 882137b1da1..66383ce3d58 100644
--- a/web/app/components/app/annotation/__tests__/index.spec.tsx
+++ b/web/app/components/app/annotation/__tests__/index.spec.tsx
@@ -188,6 +188,7 @@ it('creates an annotation from the empty page and displays the saved record', as
await waitFor(() => expect(dialog).not.toBeInTheDocument())
expect(await screen.findByRole('checkbox', { name: 'New question' })).toBeVisible()
expect(screen.getByRole('cell', { name: 'New answer' })).toBeVisible()
+ expect(screen.queryByText('common.api.actionSuccess')).not.toBeInTheDocument()
expect(api.add).toHaveBeenCalledExactlyOnceWith({
params: { app_id: 'app-id' },
body: { question: 'New question', answer: 'New answer' },
@@ -226,6 +227,7 @@ it('keeps a failed batch deletion open for retry and clears the selection after
await waitFor(() => expect(screen.queryByRole('alertdialog')).not.toBeInTheDocument())
expect(await screen.findByText('appAnnotation.noData.title')).toBeVisible()
expect(screen.queryByText('appAnnotation.batchAction.selected')).not.toBeInTheDocument()
+ expect(screen.queryByText('common.api.actionSuccess')).not.toBeInTheDocument()
expect(api.batchRemove).toHaveBeenCalledTimes(2)
expect(api.batchRemove).toHaveBeenLastCalledWith({
params: { app_id: 'app-id' },
@@ -255,6 +257,7 @@ it('saves edits from the detail drawer and shows them when reopened', async () =
await user.click(within(dialog).getByRole('button', { name: 'common.operation.close' }))
await waitFor(() => expect(dialog).not.toBeInTheDocument())
expect(await screen.findByRole('checkbox', { name: 'Edited question' })).toBeVisible()
+ expect(screen.queryByText('common.api.actionSuccess')).not.toBeInTheDocument()
await user.click(screen.getByRole('button', { name: 'appDebug.feature.annotation.edit' }))
expect(
within(
@@ -279,6 +282,7 @@ it('removes an annotation through its detail drawer and closes it', async () =>
await user.click(within(confirm).getByRole('button', { name: 'common.operation.confirm' }))
await waitFor(() => expect(dialog).not.toBeInTheDocument())
expect(await screen.findByText('appAnnotation.noData.title')).toBeVisible()
+ expect(screen.queryByText('common.api.actionSuccess')).not.toBeInTheDocument()
expect(api.remove).toHaveBeenCalledExactlyOnceWith({
params: { app_id: 'app-id', annotation_id: item.id },
})
diff --git a/web/app/components/app/annotation/index.tsx b/web/app/components/app/annotation/index.tsx
index b56a6c7da5a..521ea18bf2d 100644
--- a/web/app/components/app/annotation/index.tsx
+++ b/web/app/components/app/annotation/index.tsx
@@ -120,7 +120,6 @@ const Annotation: FC<Props> = (props) => {
params: { app_id: appDetail.id },
body: payload,
})
- toast.success(t(($) => $['api.actionSuccess'], { ns: 'common' }))
fetchList()
setControlUpdateList(Date.now())
}
@@ -129,7 +128,6 @@ const Annotation: FC<Props> = (props) => {
await consoleClient.apps.byAppId.annotations.byAnnotationId.delete({
params: { app_id: appDetail.id, annotation_id: id },
})
- toast.success(t(($) => $['api.actionSuccess'], { ns: 'common' }))
fetchList()
setControlUpdateList(Date.now())
}
@@ -140,7 +138,6 @@ const Annotation: FC<Props> = (props) => {
params: { app_id: appDetail.id },
query: { annotation_id: selectedIds },
})
- toast.success(t(($) => $['api.actionSuccess'], { ns: 'common' }))
fetchList()
setControlUpdateList(Date.now())
setSelectedIds([])
@@ -161,7 +158,6 @@ const Annotation: FC<Props> = (props) => {
params: { app_id: appDetail.id, annotation_id: currItem.id },
body: { question, answer },
})
- toast.success(t(($) => $['api.actionSuccess'], { ns: 'common' }))
fetchList()
setControlUpdateList(Date.now())
}