File tree 1 file changed +16
-2
lines changed
web/app/components/base/toast
1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -123,11 +123,25 @@ Toast.notify = ({
123
123
const holder = document . createElement ( 'div' )
124
124
const root = createRoot ( holder )
125
125
126
- root . render ( < Toast type = { type } size = { size } message = { message } duration = { duration } className = { className } /> )
126
+ root . render (
127
+ < ToastContext . Provider value = { {
128
+ notify : ( ) => { } ,
129
+ close : ( ) => {
130
+ if ( holder ) {
131
+ root . unmount ( )
132
+ holder . remove ( )
133
+ }
134
+ } ,
135
+ } } >
136
+ < Toast type = { type } size = { size } message = { message } duration = { duration } className = { className } />
137
+ </ ToastContext . Provider > ,
138
+ )
127
139
document . body . appendChild ( holder )
128
140
setTimeout ( ( ) => {
129
- if ( holder )
141
+ if ( holder ) {
142
+ root . unmount ( )
130
143
holder . remove ( )
144
+ }
131
145
} , duration || defaultDuring )
132
146
}
133
147
}
You can’t perform that action at this time.
0 commit comments