-
-
Notifications
You must be signed in to change notification settings - Fork 628
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
Structural data validation on cache writes and more #754
Conversation
This depends on gql-dart/ferry#104 getting merged, but can be tried out like so: dependency_overrides:
graphql:
git:
url: [email protected]:micimize/graphql-flutter.git
ref: norm_data_handling
path: packages/graphql |
Codecov Report
@@ Coverage Diff @@
## beta #754 +/- ##
==========================================
- Coverage 50.48% 49.29% -1.19%
==========================================
Files 34 35 +1
Lines 1240 1349 +109
==========================================
+ Hits 626 665 +39
- Misses 614 684 +70
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Note to self: Update Exceptions section with strictness errors https://github.com/zino-app/graphql-flutter/tree/beta/packages/graphql#exceptions |
…tion (from normalize), or a CacheMisconfigurationException if the structures seem like they should be valid. At link execution time, one of the following exceptions can be thrown: * CacheMisconfigurationException if the structure seems like it should write properly. * UnexpectedResponseStructureException if the server response looks malformed. * MismatchedDataStructureException in the event of a malformed optimistic result. before, one could attempt to write any data structure to the cache, and it would write whatever document-matching data there was. Now, if one attempts to write structurally partial data, appropriate exceptions will be thrown.
strict data structure exception handling for fetchMore, FetchMoreOptions.partial for dealing with __typename/structural inconsistencies, better docs. Also tightened the fetchMore types, as operation data can only be Maps.
287ac17
to
1a73495
Compare
🎉 This PR is included in version 4.0.0-beta.4 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 4.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
I got here cause Uncaught (in promise) Error: Expected a value of type 'String', but got one of type 'NativeJavaScriptObject' |
@EightRice open a new issue – that sounds like a web-related issue and at first blush doesn't look necessarily related to strict cache writes (maybe that's why the error was surfaced, but not the root cause) |
Closes #747, #744, #718, #683, #687, #616, #405
depends on gql-dart/ferry#104
result.data
carry forward on exception (#718)for
watchQuery
, when an exception results innull
data, the previous result will be used by default. Can be disabled byWatchQueryOptions(carryForwardDataOnException: false)
only rebroadcast when !deep equals by default (#616)
alwaysRebroadcast
can be used to get the old behavior back.strict cache writes (semi-breaking)
cache writes are now strict and throw PartialDataException (from normalize) or a CacheMisconfigurationException if the structures seem like they should be valid (configurable by
partialDataPolicy
)At link execution time, one of the following exceptions can be thrown:
write properly.
optimistic result.
readQuery
then returnsnull
, aCacheMissException
will be added and the data will not be overwrittenbefore, one could attempt to write any data structure to the cache, and it would write whatever document-matching data there was.
Now, if one attempts to write structurally partial data, appropriate
exceptions will be thrown.
fechMore updates
FetchMoreOptions.partial
is added for safer update operationsUpdateQuery
is now strictly typed withMap
sSkip cache writes when errors && ErrorPolicy.none (#405)
I also verified
examples/starwars
works on web and bumped the connectivity plugin to silence an error.