Open theobat opened 7 years ago
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.
So we've come up with a situation where this: https://github.com/mattkrick/cashay/compare/master...theobat:empty-object-selection Actually removes critical part of a query like:
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:
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