Skip to content

Commit

Permalink
fix(client): skip cache writes on null data, thus fixing #405
Browse files Browse the repository at this point in the history
  • Loading branch information
micimize committed Nov 6, 2020
1 parent ee64e99 commit 7472bb9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/graphql/lib/src/core/_query_write_handling.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,18 @@ extension InternalQueryWriteHandling on QueryManager {
/// Part of [InternalQueryWriteHandling], and not exposed outside the
/// library.
///
/// If we have no data, we skip caching, thus taking [ErrorPolicy.none]
/// into account
///
/// networked wrapper for [_writeQueryOrSetExceptionOnQueryResult]
/// NOTE: mapFetchResultToQueryResult must be called beforehand
bool attemptCacheWriteFromResponse(
FetchPolicy fetchPolicy,
Request request,
Response response,
QueryResult queryResult,
) =>
(fetchPolicy == FetchPolicy.noCache || response.data == null)
(fetchPolicy == FetchPolicy.noCache || queryResult.data == null)
? false
: _writeQueryOrSetExceptionOnQueryResult(
request,
Expand Down

0 comments on commit 7472bb9

Please sign in to comment.