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

Reset store functionality #898

Closed
wants to merge 9 commits into from
Closed

Reset store functionality #898

wants to merge 9 commits into from

Conversation

Globegitter
Copy link
Contributor

Fixes #233.

Tested it in one of our apps and seems to do the trick.

Since this is my first PR I am not so sure about all the conventions but tried to follow it as much as possible for unit tests, etc.

@facebook-github-bot
Copy link
Contributor

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!

@facebook-github-bot
Copy link
Contributor

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

@@ -70,6 +77,16 @@ describe('RelayContext', () => {
});
});

describe('reset', () => {
fit('invokes its invariant', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

s/fit/it/

@josephsavona
Copy link
Contributor

Thanks for working on this. Eventually we won't need a reset method because you will just create a new RelayContext instead. I'm not sure if we want to add an API that we'll delete so soon, but in this case there is enough demand that it might be best to proceed. Let's get some feedback here before proceeding.

Cc @wincent

@schickling
Copy link
Contributor

Would love to use this! 👍

@wincent
Copy link
Contributor

wincent commented Mar 3, 2016

This is great!

But as @josephsavona points out, won't be needed once everything is isolated inside RelayContext. The concern that we'll soon delete the reset() API is valid, but I actually think there's a deeper reason that even having the API in the first place is a bit wrongful. Being able to reset to a clean state via mutating is a fundamentally brittle design (even if it's right now, what if somebody ends up adding additional global state outside the RelayStoreData?) compared to literally replacing the entire context. So, I think we should hold off on this for now and if you need something like this you can run with a patch on top of base Relay. Thoughts?

@josephsavona
Copy link
Contributor

So, I think we should hold off on this for now and if you need something like this you can run with a patch on top of base Relay.

I'm inclined to agree. We're making good progress on #558 and expect to have RelayContext be public within the next few releases.

@Globegitter
Copy link
Contributor Author

Felt like dipping a little bit into relay and this one seemed like a good, simple start. But that is totally fair and good to see things are progressing.

@josephsavona
Copy link
Contributor

@Globegitter Thanks for opening this PR - it helps us see what features people are most interested in and moves the discussion forward (even if the PR itself doesn't land). Definitely check out the help-wanted tag for other places to contribute!

Closing per discussion above - there are pending diffs for all the remaining code changes on #558.

@tlvenn
Copy link
Contributor

tlvenn commented Apr 7, 2016

Eventually we won't need a reset method because you will just create a new RelayContext instead.

Now that #558 has landed, can we expose RelayEnvironment to the public API (Relay.Environment) so we can instantiate it ?

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.

6 participants