@@ -15,33 +15,33 @@ export enum ActionType {
1515
1616type Action =
1717 | {
18- type : ActionType . ADD_TOAST ;
19- toast : Toast ;
20- }
18+ type : ActionType . ADD_TOAST ;
19+ toast : Toast ;
20+ }
2121 | {
22- type : ActionType . UPSERT_TOAST ;
23- toast : Toast ;
24- }
22+ type : ActionType . UPSERT_TOAST ;
23+ toast : Toast ;
24+ }
2525 | {
26- type : ActionType . UPDATE_TOAST ;
27- toast : Partial < Toast > ;
28- }
26+ type : ActionType . UPDATE_TOAST ;
27+ toast : Partial < Toast > ;
28+ }
2929 | {
30- type : ActionType . DISMISS_TOAST ;
31- toastId ?: string ;
32- }
30+ type : ActionType . DISMISS_TOAST ;
31+ toastId ?: string ;
32+ }
3333 | {
34- type : ActionType . REMOVE_TOAST ;
35- toastId ?: string ;
36- }
34+ type : ActionType . REMOVE_TOAST ;
35+ toastId ?: string ;
36+ }
3737 | {
38- type : ActionType . START_PAUSE ;
39- time : number ;
40- }
38+ type : ActionType . START_PAUSE ;
39+ time : number ;
40+ }
4141 | {
42- type : ActionType . END_PAUSE ;
43- time : number ;
44- } ;
42+ type : ActionType . END_PAUSE ;
43+ time : number ;
44+ } ;
4545
4646interface State {
4747 toasts : Toast [ ] ;
@@ -55,16 +55,13 @@ const addToRemoveQueue = (toastId: string) => {
5555 return ;
5656 }
5757
58- const timeout = setTimeout (
59- ( ) => {
60- toastTimeouts . delete ( toastId ) ;
61- dispatch ( {
62- type : ActionType . REMOVE_TOAST ,
63- toastId : toastId ,
64- } ) ;
65- } ,
66- 1000
67- ) ;
58+ const timeout = setTimeout ( ( ) => {
59+ toastTimeouts . delete ( toastId ) ;
60+ dispatch ( {
61+ type : ActionType . REMOVE_TOAST ,
62+ toastId : toastId ,
63+ } ) ;
64+ } , 1000 ) ;
6865
6966 toastTimeouts . set ( toastId , timeout ) ;
7067} ;
@@ -120,9 +117,9 @@ export const reducer = (state: State, action: Action): State => {
120117 toasts : state . toasts . map ( ( t ) =>
121118 t . id === toastId || toastId === undefined
122119 ? {
123- ...t ,
124- visible : false ,
125- }
120+ ...t ,
121+ visible : false ,
122+ }
126123 : t
127124 ) ,
128125 } ;
0 commit comments