@urql/exchange-graphcache
Advanced tools
Comparing version 1.0.0-rc.3 to 1.0.0-rc.4
@@ -382,3 +382,3 @@ import { Kind, buildClientSchema, isNullableType, isNonNullType, isListType, GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType } from "graphql"; | ||
} | ||
if ("production" !== process.env.NODE_ENV && ctx.schemaPredicates) { | ||
if ("production" !== process.env.NODE_ENV && ctx.schemaPredicates && typename) { | ||
ctx.schemaPredicates.isFieldAvailableOnType(typename, fieldName); | ||
@@ -482,3 +482,3 @@ } | ||
var fieldKey = joinKeys(entityKey, keyOfField(fieldName, fieldArgs)); | ||
if ("production" !== process.env.NODE_ENV && ctx.schemaPredicates) { | ||
if ("production" !== process.env.NODE_ENV && ctx.schemaPredicates && typename) { | ||
ctx.schemaPredicates.isFieldAvailableOnType(typename, fieldName); | ||
@@ -806,3 +806,3 @@ } | ||
} | ||
if ("production" !== process.env.NODE_ENV && schemaPredicates) { | ||
if ("production" !== process.env.NODE_ENV && schemaPredicates && typename) { | ||
schemaPredicates.isFieldAvailableOnType(typename, fieldName); | ||
@@ -809,0 +809,0 @@ } |
@@ -386,3 +386,3 @@ "use strict"; | ||
} | ||
if ("production" !== process.env.NODE_ENV && ctx.schemaPredicates) { | ||
if ("production" !== process.env.NODE_ENV && ctx.schemaPredicates && typename) { | ||
ctx.schemaPredicates.isFieldAvailableOnType(typename, fieldName); | ||
@@ -486,3 +486,3 @@ } | ||
var fieldKey = joinKeys(entityKey, keyOfField(fieldName, fieldArgs)); | ||
if ("production" !== process.env.NODE_ENV && ctx.schemaPredicates) { | ||
if ("production" !== process.env.NODE_ENV && ctx.schemaPredicates && typename) { | ||
ctx.schemaPredicates.isFieldAvailableOnType(typename, fieldName); | ||
@@ -810,3 +810,3 @@ } | ||
} | ||
if ("production" !== process.env.NODE_ENV && schemaPredicates) { | ||
if ("production" !== process.env.NODE_ENV && schemaPredicates && typename) { | ||
schemaPredicates.isFieldAvailableOnType(typename, fieldName); | ||
@@ -813,0 +813,0 @@ } |
{ | ||
"name": "@urql/exchange-graphcache", | ||
"version": "1.0.0-rc.3", | ||
"version": "1.0.0-rc.4", | ||
"description": "A normalized and configurable cache exchange for urql", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/FormidableLabs/urql-exchange-graphcache", |
@@ -77,3 +77,7 @@ import { | ||
if (process.env.NODE_ENV !== 'production' && ctx.schemaPredicates) { | ||
if ( | ||
process.env.NODE_ENV !== 'production' && | ||
ctx.schemaPredicates && | ||
typename | ||
) { | ||
ctx.schemaPredicates.isFieldAvailableOnType(typename, fieldName); | ||
@@ -80,0 +84,0 @@ } |
@@ -111,2 +111,34 @@ import { Store } from '../store'; | ||
}); | ||
// Issue#64 | ||
it('should not crash for valid queries', () => { | ||
const VALID_QUERY = gql` | ||
query getTodos { | ||
todos { | ||
id | ||
text | ||
} | ||
} | ||
`; | ||
// Use new store to ensure bug reproduction | ||
const store = new Store(new SchemaPredicates(schema)); | ||
let { data } = query(store, { query: VALID_QUERY }); | ||
expect(data).toEqual(null); | ||
write( | ||
store, | ||
{ query: VALID_QUERY }, | ||
// @ts-ignore | ||
{ | ||
// Removing typename here would formerly crash this. | ||
todos: [{ __typename: 'Todo', id: '0', text: 'Solve bug' }], | ||
} | ||
); | ||
({ data } = query(store, { query: VALID_QUERY })); | ||
expect(data).toEqual({ | ||
__typename: 'Query', | ||
todos: [{ __typename: 'Todo', id: '0', text: 'Solve bug' }], | ||
}); | ||
}); | ||
}); |
@@ -186,3 +186,3 @@ import { warning } from '../helpers/warning'; | ||
if (process.env.NODE_ENV !== 'production' && schemaPredicates) { | ||
if (process.env.NODE_ENV !== 'production' && schemaPredicates && typename) { | ||
schemaPredicates.isFieldAvailableOnType(typename, fieldName); | ||
@@ -189,0 +189,0 @@ } |
@@ -207,3 +207,7 @@ import { warning } from '../helpers/warning'; | ||
if (process.env.NODE_ENV !== 'production' && ctx.schemaPredicates) { | ||
if ( | ||
process.env.NODE_ENV !== 'production' && | ||
ctx.schemaPredicates && | ||
typename | ||
) { | ||
ctx.schemaPredicates.isFieldAvailableOnType(typename, fieldName); | ||
@@ -210,0 +214,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
547405
6135