microsoft / azure-devops-extension-sdk

Client SDK for developing Azure DevOps extensions
MIT License
123 stars 38 forks source link

GlobalMessagesService onClick does not work for IDialog service #50

Open zkbule opened 2 years ago

zkbule commented 2 years ago

using azure-devops-extension-sdk 2.0.11, this is the code:

this.messagesService.addDialog({ message: "New Corner Dialog", title: "Dialog Title" buttonProps: [{ primary: true, text: "Accept", onClick: () => {alert("onClick")} }] });

when click the button, the onClick does not response which cause whole page hang

xkrchnav commented 1 year ago

It is possible to work around it using host service:

const service = await SDK.getService<IHostPageLayoutService>(CommonServiceIds.HostPageLayoutService);
service.openMessageDialog(message, {
  title,
  showCancel: true,
  onClose: (result) => (result ? alert("OK") : alert("Cancel"),
});