Commit 6953907 1 parent 7cc27d5 commit 6953907 Copy full SHA for 6953907
File tree 1 file changed +11
-2
lines changed
packages/snackbar/src/lib
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ const logger = createLogger(`${__package_name__}`);
11
11
/**
12
12
* Store the function to close the last snackbar.
13
13
*/
14
- let closeLastSnackbar : ( ( ) => Promise < void > ) | null = null ;
14
+ let closeLastSnackbar : ( ( ) => MaybePromise < void > ) | null = null ;
15
15
16
16
/**
17
17
* Store the function to unsubscribe the action button handler after close or action button clicked.
@@ -53,7 +53,16 @@ function createSnackbarElement(options: SnackbarOptions): SnackbarElement {
53
53
function handleActionButtonClick ( closeSnackbar : ( ) => Promise < void > , handler ?: SnackbarActionHandler ) : Promise < void > {
54
54
logger . logMethod ?.( 'handleActionButtonClick' ) ;
55
55
56
- handler ?.( ) ;
56
+ // non-blocking to handler done
57
+ ( async ( ) => {
58
+ try {
59
+ await handler ! ( ) ;
60
+ }
61
+ catch ( error ) {
62
+ logger . error ( 'handleActionButtonClick' , 'call_handler_failed' , error ) ;
63
+ }
64
+ } ) ( ) ;
65
+
57
66
return closeSnackbar ( ) ;
58
67
}
59
68
You can’t perform that action at this time.
0 commit comments