Skip to content

Commit

Permalink
fix(graphql): Normalization signature
Browse files Browse the repository at this point in the history
  • Loading branch information
budde377 committed Aug 13, 2022
1 parent 7a84abb commit dc5207a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/graphql/lib/src/cache/_normalizing_data_proxy.dart
Expand Up @@ -65,7 +65,7 @@ abstract class NormalizingDataProxy extends GraphQLDataProxy {
/// The key differentiating factor for an implementing `cache` or `proxy`
/// is usually how they handle [optimistic] reads.
@protected
Map<String, dynamic>? readNormalized(String rootId, {bool? optimistic});
Map<String, dynamic>? readNormalized(String rootId, {bool optimistic});

/// Write normalized data into the cache.
///
Expand All @@ -80,7 +80,7 @@ abstract class NormalizingDataProxy extends GraphQLDataProxy {

Map<String, dynamic>? readQuery(
Request request, {
bool? optimistic = true,
bool optimistic = true,
}) =>
denormalizeOperation(
// provided from cache
Expand All @@ -100,7 +100,7 @@ abstract class NormalizingDataProxy extends GraphQLDataProxy {

Map<String, dynamic>? readFragment(
FragmentRequest fragmentRequest, {
bool? optimistic = true,
bool optimistic = true,
}) =>
denormalizeFragment(
// provided from cache
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql/lib/src/cache/_optimistic_transactions.dart
Expand Up @@ -59,8 +59,8 @@ class OptimisticProxy extends NormalizingDataProxy {

@override
Map<String, dynamic>? readNormalized(String rootId,
{bool? optimistic = true}) {
if (!optimistic!) {
{bool optimistic = true}) {
if (!optimistic) {
return cache.readNormalized(rootId, optimistic: false);
}
// the cache calls `patch.data.containsKey(rootId)`,
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql/lib/src/cache/data_proxy.dart
Expand Up @@ -98,7 +98,7 @@ import './fragment.dart';
/// ```
abstract class GraphQLDataProxy {
/// Reads a GraphQL query from the root query id.
Map<String, dynamic>? readQuery(Request request, {bool? optimistic});
Map<String, dynamic>? readQuery(Request request, {bool optimistic});

/// Reads a GraphQL fragment from any arbitrary id.
///
Expand All @@ -107,7 +107,7 @@ abstract class GraphQLDataProxy {
/// to select the correct fragment.
Map<String, dynamic>? readFragment(
FragmentRequest fragmentRequest, {
bool? optimistic,
bool optimistic,
});

/// Writes a GraphQL query to the root query id,
Expand Down

0 comments on commit dc5207a

Please sign in to comment.