-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[WIP] Query diffing #5
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
Conversation
Interesting issue. To refetch
You need to do:
This means that the client that sends the query needs to be aware of the type of the node it's refetching. That's pretty unfortunate, because there aren't many other situations which require type information. Possible solutions:
(2) seems like the sane option here, so I'm probably going to go with that. |
I agree that The only issue with that I guess is if the server updates with new fields between requests, the client side would have to make an extra trip after realizing the field now exists so maybe that is a bad idea. |
So far, my mental model is that query validation is a development-time concern rather than something you would do in production, just because of the performance overhead (in production, my assumption would be that the schema doesn't change very often, and in the overwhelming majority of cases it will be adding new fields vs. removing them) But regardless, I agree that having type information on the client is useful. For example, "give me all of the todo items currently in the cache" in a minimongo style could be a very useful operation to have available, even in production. |
Going to throw away this branch and start over with typescript |
This is the beginning of implementing a feature where the client can detect when part of a query is already in the cache, and create a set of queries to refetch only the necessary objects/fields.