Skip to content

Commit

Permalink
fix: cannot close notification manually
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzuodong committed Dec 9, 2024
1 parent c3c6a48 commit 3b6e3ca
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion web/app/components/base/toast/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,17 @@ 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)
holder.remove()
},
}}>
<Toast type={type} size={size} message={message} duration={duration} className={className} />
</ToastContext.Provider>,
)
document.body.appendChild(holder)
setTimeout(() => {
if (holder)
Expand Down

0 comments on commit 3b6e3ca

Please sign in to comment.