Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

let onDispatch signal "handled" #13

Open
billba opened this issue May 3, 2018 · 2 comments
Open

let onDispatch signal "handled" #13

billba opened this issue May 3, 2018 · 2 comments

Comments

@billba
Copy link
Owner

billba commented May 3, 2018

It might be useful to let onDispatch signal that it has handled the utterance.

The simplest thing would be to return true if the utterance was handled. But handling the utterance is probably the default. It would be ideal if you only had to write extra code if you didn't handle the utterance.

So maybe return false if you didn't handle it? Anything else, including no return, would be considered "handled".

Then the following has new meaning (and value):

if (await this.onDispatchToChild()) {
    // no child, or it didn't handle it
}

Question: would it ever be useful to distinguish between the two cases? Actually we know if we have a child, so that's easy to figure out.

@Stevenic
Copy link

Stevenic commented May 7, 2018

I struggled with this in botbuilder-dialogs as well and ultimately landed on just using context.responded to determine if something was handled. It's a bit indirect as we're assuming the fact you sent a reply means you handled it but if you did send a reply its probably safe to say you handled the utterance and what's nice is you didn't need to remember to return something.

You can argue that a case exists where I handled the utterance and intentionally chose not to reply but that seems really rare and if you wanted to do that you could explicitly set context.responded = true; to ensure no fallback code runs.

@billba
Copy link
Owner Author

billba commented May 7, 2018

I think I'm going to go the other way. I'm taking context.responded at face value, and I do indeed want to handle cases where the activity is handled without a response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants