Skip to content

messageFromChildHandler not triggered by dialog.url.sendMessageToParentFromDialog #2832

Open
@ignite-cykim

Description

@ignite-cykim

When using the Microsoft Teams SDK v2 dialog.url.open() method and supplying a messageFromChildHandler as the third parameter, messages sent from the dialog via dialog.url.sendMessageToParentFromDialog() are not received by the handler.

To Reproduce

In the main app, open the dialog like this:

import { dialog } from "@microsoft/teams-js";

dialog.url.open({
  url: "https://mydomain.com ~ sthsth",
  size: { height: 400, width: 500 },
}, 
(result, reason) => {
  console.log("Dialog closed", result, reason);
}, // <-- This works
(message) => {
  console.log("Received message from child dialog", message); // <-- This never fires
});

In the dialog page:

import { dialog } from "@microsoft/teams-js";

await dialog.url.sendMessageToParentFromDialog({
  type: "MY_CUSTOM_MESSAGE",
  payload: "hello from child"
});

Observe that the messageFromChildHandler does not trigger.

Expected behavior

The third parameter (messageFromChildHandler) of dialog.url.open() should be called when dialog.url.sendMessageToParentFromDialog() is invoked from the child dialog.

Actual behavior

No message is received.

SDK version

@microsoft/teams-js: 2.13.0

Environment

Teams Desktop App (not tested web)
OS: macOS

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions