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

Rewrite fragment evaluation to do less guessing #767

Merged
merged 10 commits into from
Oct 15, 2016
Merged

Rewrite fragment evaluation to do less guessing #767

merged 10 commits into from
Oct 15, 2016

Conversation

stubailo
Copy link
Contributor

@stubailo stubailo commented Oct 13, 2016

TODO:

  • If this PR is a new feature, reference an issue where a consensus about the design was reached (not necessary for small changes)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass
  • Update CHANGELOG.md with your change
  • Add your name and email to the AUTHORS file (optional)
  • If this was a change that affects the external API, update the docs and post a link to the PR in the discussion

@stubailo
Copy link
Contributor Author

I'm going to make a bold claim here: We should remove the returnPartialData option from writeQueryToStore and readQueryFromStore functions entirely.

I think it makes sense as an option to watchQuery - you don't want to get data before the loading state is false, but in other situations I can't imagine why it would be helpful to throw an internal apollo client error rather than returning data. Since the data is guaranteed to come back from the server pre-validated, the only situations this could be relevant are:

  1. When validating the results of query reducers, which is a separate problem that we should tackle in a special way
  2. When the store is updated partially to a state that the server would never return

Both of those seem only really solvable in the abstract with full knowledge of the schema, so having a half-baked way to identify errors by throwing on missing or extra fields doesn't seem like a good idea since it will almost certainly cause more problems (by being implemented incorrectly) than it solves.

Curious to get your thoughts on this, @helfer.

@stubailo
Copy link
Contributor Author

OK I ended up making a lot of changes - @helfer ping me so we can talk before merging.

@stubailo stubailo changed the title Fix #739 Rewrite fragment evaluation to do less guessing Oct 15, 2016
@stubailo stubailo merged commit 79ca7d3 into master Oct 15, 2016
@stubailo stubailo deleted the fix-739 branch October 15, 2016 22:05
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants