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

port: add handledProperty to emitEvent #3686

Merged
merged 4 commits into from
May 17, 2021

Conversation

mdrichardson
Copy link
Contributor

Fixes #3594

Description

Added a new "Handled Property" property which lets you specify where to return a flag indicating if the event was handled.

@mdrichardson mdrichardson requested review from chrimc62, tomlm and a team as code owners May 13, 2021 18:33
Comment on lines 101 to 104
case 'bubbleEvent':
return new BoolExpressionConverter();
case 'disabled':
return new BoolExpressionConverter();
default:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This is just to collapse the case statements since they're duplicates.

@mdrichardson mdrichardson changed the title add handledProperty to emitEvent port: add handledProperty to emitEvent May 13, 2021
@coveralls
Copy link

coveralls commented May 13, 2021

Pull Request Test Coverage Report for Build 850767067

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.004%) to 85.446%

Totals Coverage Status
Change from base Build 843088104: 0.004%
Covered Lines: 19221
Relevant Lines: 21397

💛 - Coveralls

/**
* The property path to store whether the event was handled or not.
*/
public handledProperty: StringExpression;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be public handledProperty?: StringExpression;?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, but that comment did make me realize I forgot to default it to turn.eventHandled.

If you're questioning the ? because of:

export interface EmitEventConfiguration extends DialogConfiguration {
    [...]
    handledProperty?: StringProperty;
}

...I'm not really sure. The interface and class property optionality is kind of inconsistent across the JS Adaptive library, but it seems like it's mostly:

  1. Optional in the interface
  2. Required in the class property

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's likely only required in the class property due to not using strict mode. IMO the class and the interface should match. In this case, if there is a default value, the property should not be marked as optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, make it required in the ...Configuration interface, as well, then? None of the class properties are marked optional; should I also make the rest of them required in the interface? Again, normally I would, but there isn't really a pattern in the Adaptive library for this. Actually, I think just about all of the ...Configuration interfaces across adaptive have all-optional keys.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's sync up on a call this week to discuss, I think we can make some more general improvements. In the meantime, I won't hold this PR up.

@mdrichardson mdrichardson merged commit c5b0326 into microsoft:main May 17, 2021
@mdrichardson mdrichardson deleted the handledProperty branch May 17, 2021 21:55
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

Successfully merging this pull request may close these issues.

port: Added HandledProperty to EmitEvent action (#5446)
3 participants