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

Add componentWillReceiveProps to CellExpand #862

Merged
merged 5 commits into from
Jul 6, 2017
Merged

Conversation

diegomurakami
Copy link
Contributor

Description

This PR will add componentWilLReceiveProps to CellExpand in order to update the state when receiving the *expanded" from external data.

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x")

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?
The subrow icon only changes with the click event.

What is the new behavior?
It will continue to change on the click event but also change when receiving the information by props.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

testElement.simulate('click');
expect(testElement.state('expanded')).toBeTruthy();
let secondProps = getFakeProps(false);
testElement = renderComponent(secondProps);
Copy link
Contributor

Choose a reason for hiding this comment

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

This creates a new component, use testElement.setProps

@@ -6,6 +6,9 @@ const CellExpand = React.createClass({
let expanded = this.props.expandableOptions && this.props.expandableOptions.expanded;
return { expanded: expanded };
},
componentWillReceiveProps(nextProps) {
this.setState(nextProps.props.expandableOptions && nextProps.props.expandableOptions.expanded);
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this fancy thing?

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 001e9f5 on dm-fix-subrow-state into ** on master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 2992dc0 on dm-fix-subrow-state into ** on master**.

@diogofcunha diogofcunha merged commit 152e6cf into master Jul 6, 2017
@amanmahajan7 amanmahajan7 deleted the dm-fix-subrow-state branch March 14, 2019 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants