cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP Composable Storefront - Closing a Dialog service doesnt work

sudarsaan_g
Explorer
0 Likes
380

SAP Composabel Storefront:

I am trying to close the pop-up dialog but it is not working.

I have followed the steps mentioned in this below URL, but that still doesnt close the dialog (no error in the console)

this.launchDialogService.closeDialog('userClickedCloseButton');

https://help.sap.com/docs/SAP_COMMERCE_COMPOSABLE_STOREFRONT/eaef8c61b6d9477daf75bff9ac1b7eb4/c87a11...

Can someone please help out on this

Accepted Solutions (0)

Answers (1)

Answers (1)

Gabriel-Toebe
Product and Topic Expert
Product and Topic Expert
0 Likes

Hello,

I suggest trying to use openDialogAndSubscribe instead of openDialog as mentioned here:
https://help.sap.com/docs/SAP_COMMERCE_COMPOSABLE_STOREFRONT/eaef8c61b6d9477daf75bff9ac1b7eb4/c87a11...

Or you can keep using launchDialogService and add the following code:

 
const dialog = this.launchDialogService.openDialogAndSubscribe(LAUNCH_CALLER.MY_MODAL); if (dialog) { dialog.pipe(take(1)).subscribe();

This is important because observables are lazy, so without subscribing, the dialog may not open properly or respond to closeDialog() calls.

Also, please ensure that the LAUNCH_CALLER.MY_MODAL value matches your dialog configuration, and that your dialog component is correctly registered in your storefront setup.