Validate that the data matches the shape of a query before writing it back into the store
See original GitHub issueThis issue combines the problem described in #973 #1123 #1273 #1293 #1588 #1605
Intended outcome:
Apollo should throw an error or a warning when the returned data from updateQueries
or reducer
does not match the shape of the query that is intended to be updated.
Actual outcome: Apollo flushes the data without any warning.
An insight into this problem is here.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Reading and writing data to the cache - Apollo GraphQL Docs
The writeQuery method enables you to write data to your cache in a shape that matches a GraphQL query. It resembles readQuery ,...
Read more >20 SQL for Pattern Matching - Oracle Help Center
Pattern matching can let you identify price patterns, such as V-shapes and W-shapes illustrated in Figure 20-1, along with performing many types of...
Read more >Shapes Constraint Language (SHACL) - W3C
Abstract. This document defines the SHACL Shapes Constraint Language, a language for validating RDF graphs against a set of conditions.
Read more >Chapter 3. Data, Tables, and Database Design - O'Reilly
THE FIX: Normalizing basically means organizing data to reduce redundancy. As the esteemed Webopedia ( http://www.pcwebopedia.com ) pithily puts it, it involves ...
Read more >Set Validation Rules for Your Schema — MongoDB Compass
Schema validation ensures that all documents in a collection follow a defined set of rules, such as conforming to a specific shape or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think it would be great to explain this explicitly in the docs. It can be a way to prevent this error from being made in the first place (unconsciously or thinking that if you don’t want to provide a value, you should omit it —instead of providing a null-like value).
Although it is briefly explained here, I do think it should be documented as well in Updating the Store and Optimistic UI.
@jakelacey2012 would you like to do a PR in react-docs to provide better information in these pages or somewhere else that you think might be useful?
I don’t get this. Lets say I have a type:
Then I query a list of this type
And then I call a mutation like
Is it expected, that
items
will now be undefined? I’ve had a very similar scenario where this was the case. The example above does not match it 100%, but it was extremely similar as where I’ve been querying/mutating the same type, but the query would only have a subset of the mutation fields.