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: cannot close notification manually (#11490)

Hash Brown2866383228cc
diff --git a/web/app/components/base/toast/index.tsx b/web/app/components/base/toast/index.tsx
index b1b9ffe8c4e..b9a6de9fe5a 100644
--- a/web/app/components/base/toast/index.tsx
+++ b/web/app/components/base/toast/index.tsx
@@ -123,11 +123,25 @@ Toast.notify = ({
const holder = document.createElement('div')
const root = createRoot(holder)
- root.render(<Toast type={type} size={size} message={message} duration={duration} className={className} />)
+ root.render(
+ <ToastContext.Provider value={{
+ notify: () => {},
+ close: () => {
+ if (holder) {
+ root.unmount()
+ holder.remove()
+ }
+ },
+ }}>
+ <Toast type={type} size={size} message={message} duration={duration} className={className} />
+ </ToastContext.Provider>,
+ )
document.body.appendChild(holder)
setTimeout(() => {
- if (holder)
+ if (holder) {
+ root.unmount()
holder.remove()
+ }
}, duration || defaultDuring)
}
}