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

Emptying object selections #167

Open
theobat opened this issue Jun 6, 2017 · 1 comment
Open

Emptying object selections #167

theobat opened this issue Jun 6, 2017 · 1 comment

Comments

@theobat
Copy link
Contributor

theobat commented Jun 6, 2017

So we've come up with a situation where this:
master...theobat:empty-object-selection
Actually removes critical part of a query like:

query {
  id
  content
  test {
    id
  }
}

Would work just fine until we reach the point where the mutationHandler invalidate the query and the query is refetched. A this point cashay rebuild a query like this:

query {
  id
  content
  test
}

Which is not valid. So at first glance I decided to just properly remove the object that cashay emptied but then I realized I needed this object... What's the idea behind the comment just above the line responsible for this ?
https://github.com/mattkrick/cashay/blob/master/src/query/printMinimalQuery.js#L64

@mattkrick
Copy link
Owner

ah, that's a good catch
so the motive is payload reduction, basically create a object of everything you have locally & then remove those things. now if you don't have the id field locally, then firstField.sendToServer should be true. from the query you pasted it looks like it did a good job of removing unnecessary children, but it didn't clean up the empty parents.

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

No branches or pull requests

2 participants