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

Make result name suggestion for new msg waits #181

Merged
merged 8 commits into from
Mar 19, 2018

Conversation

ericnewcomer
Copy link
Member

@ericnewcomer ericnewcomer commented Mar 15, 2018

Fixes: #156 (this still needs unit tests)

tsconfig.json Outdated
@@ -14,7 +14,7 @@
"allowJs": true,
"watch": true,
"alwaysStrict": true,
"lib": ["es6", "dom"]
"lib": ["es2017", "dom"]
Copy link
Contributor

Choose a reason for hiding this comment

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

why the change here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Object.values() .. so certainly not necessary, but don't see any reason to avoid it.

More here: microsoft/TypeScript#10768

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmmm.. but that is failing the node 6 build, so maybe there's one.

Copy link
Contributor

Choose a reason for hiding this comment

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

nice, can't wait for that to land

Copy link
Contributor

Choose a reason for hiding this comment

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

Object.entries()?

@@ -330,9 +340,30 @@ export default class Flow extends React.Component<FlowProps, FlowState> {

ghost.actions.push(replyAction);
} else {
// coun't up all our msg waits
let responseNumber = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

should these be broken-out into helper methods, e.g. getResponseNumber and getResultName? would that make testing easier?

this.setState({
show: true,
config
...this.getInitialState(),
Copy link
Contributor

Choose a reason for hiding this comment

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

yes eric, yes...embrace the spread operator...

Copy link
Member Author

Choose a reason for hiding this comment

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

special case!

@ericnewcomer
Copy link
Member Author

@ycleptkellan what say we merge this so we don't have anything outstanding against master

@ycleptkellan
Copy link
Contributor

aye, merge away

* Gets a suggested result name based on the current number of waits
* in the current definition
*/
public getSuggestedResultName(): string {
Copy link
Contributor

@ycleptkellan ycleptkellan Mar 17, 2018

Choose a reason for hiding this comment

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

@ericnewcomer what think you about–in the future–shying away from adding methods to component classes that don't either handle a callback that changes state somewhere in the render tree or determine whether or not markdown is rendered? my reasoning is that a method that doesn't read from the component's this context is much easier to test (no need to render Flow and access it's instance before testing getSuggestedResultName).

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed.

@@ -40,5 +40,16 @@ describe('Flow >', () => {
expect(getSpecWrapper(wrapper, 'nodes').hasClass('node_list')).toBeTruthy();
expect(wrapper.find('NodeComp')).toBeTruthy();
});

it('should suggest appropriate response names', () => {
const wrapper = shallow(<Flow {...props} />, {
Copy link
Contributor

Choose a reason for hiding this comment

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

Alt Text

@ericnewcomer ericnewcomer merged commit 168c8b4 into master Mar 19, 2018
@ericnewcomer ericnewcomer deleted the named_msg_waits_156 branch March 19, 2018 18:27
paulobernardoaf added a commit to Ilhasoft/floweditor that referenced this pull request Feb 9, 2024
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.

2 participants