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 ability to remove/reset state back to null #2650

Closed
wants to merge 2 commits into from
Closed

Add ability to remove/reset state back to null #2650

wants to merge 2 commits into from

Conversation

romanmatiasko
Copy link

As mentioned in #2572, replaceState(null) should set the state of component back to null.

@syranide
Copy link
Contributor

syranide commented Dec 3, 2014

removeState seems rather superflous, replaceState(null) should be enough no?

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

@romanmatiasko
Copy link
Author

Yes, that's exactly what I meant. There isn't any new method, you're able to reset it by calling replaceState(null).

@@ -48,6 +48,10 @@ describe('ReactCompositeComponent-state', function() {
this.setState({color: nextColor});
},

removeState: function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

But you expose removeState here...

Copy link
Author

Choose a reason for hiding this comment

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

I didn't know you meant the test, I'll fix that. :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Oooh, it looked like it was exposed in the component. Then it's all good :)

Copy link
Author

Choose a reason for hiding this comment

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

Sorry for the confusion. :)

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@jimfb
Copy link
Contributor

jimfb commented Feb 27, 2015

I think we're leaning towards dropping support for replaceState. #3236

Dropping replacestate has been an ongoing discussion since January (#2843)

Thanks for the PR though! If we were going to keep replaceState, I would say we should fix this behavior, because I agree with you, it's current implementation is inconsistent/wrong. That said, I'm going to close this PR, since I think it's likely we'll be removing replacestate, and it's better to do that in one hop, rather than changing behavior and then removing it anyway.

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

Successfully merging this pull request may close these issues.

5 participants