@shopify/react-graphql
Advanced tools
Comparing version 0.0.0-snapshot-20230203161211 to 0.0.0-snapshot-20230206191454
@@ -6,2 +6,3 @@ 'use strict'; | ||
var React = require('react'); | ||
var reactHooks = require('@shopify/react-hooks'); | ||
var reactAsync = require('@shopify/react-async'); | ||
@@ -17,2 +18,3 @@ | ||
}); | ||
const mounted = reactHooks.useMountedRef(); | ||
const loadDocument = React.useCallback(async () => { | ||
@@ -22,3 +24,6 @@ if (!isDocumentNode(documentOrAsyncDocument)) { | ||
const resolved = await documentOrAsyncDocument.resolver.resolve(); | ||
setDocument(resolved); | ||
if (mounted.current) { | ||
setDocument(resolved); | ||
} | ||
} catch (error) { | ||
@@ -28,3 +33,3 @@ throw Error('error loading GraphQL document'); | ||
} | ||
}, [documentOrAsyncDocument]); | ||
}, [documentOrAsyncDocument, mounted]); | ||
React.useEffect(() => { | ||
@@ -31,0 +36,0 @@ if (!document) { |
import { AsyncQueryComponentType } from '../types'; | ||
import { Options } from './query'; | ||
export declare function createAsyncQueryComponent<Data, Variables, DeepPartial>(options: Options<Data, Variables, DeepPartial>): AsyncQueryComponentType<Data, Variables, DeepPartial>; | ||
export declare function createAsyncQueryComponent<Data extends {}, Variables extends {}, DeepPartial extends {}>(options: Options<Data, Variables, DeepPartial>): AsyncQueryComponentType<Data, Variables, DeepPartial>; | ||
//# sourceMappingURL=component.d.ts.map |
@@ -6,3 +6,3 @@ import { DocumentNode } from 'graphql-typed'; | ||
} | ||
export declare function createAsyncQuery<Data, Variables, DeepPartial>({ id, load, }: Options<Data, Variables, DeepPartial>): AsyncDocumentNode<Data, Variables, DeepPartial>; | ||
export declare function createAsyncQuery<Data extends {}, Variables extends {}, DeepPartial extends {}>({ id, load, }: Options<Data, Variables, DeepPartial>): AsyncDocumentNode<Data, Variables, DeepPartial>; | ||
//# sourceMappingURL=query.d.ts.map |
import { OperationVariables } from 'apollo-client'; | ||
import { DocumentNode } from 'graphql-typed'; | ||
import { AsyncDocumentNode } from '../types'; | ||
export default function useGraphQLDocument<Data = any, Variables = OperationVariables, DeepPartial = {}>(documentOrAsyncDocument: DocumentNode<Data, Variables> | AsyncDocumentNode<Data, Variables, DeepPartial>): DocumentNode<Data, Variables> | null; | ||
export default function useGraphQLDocument<Data extends {} = any, Variables extends OperationVariables = OperationVariables, DeepPartial extends {} = {}>(documentOrAsyncDocument: DocumentNode<Data, Variables> | AsyncDocumentNode<Data, Variables, DeepPartial>): DocumentNode<Data, Variables> | null; | ||
//# sourceMappingURL=graphql-document.d.ts.map |
@@ -6,3 +6,3 @@ import { OperationVariables } from 'apollo-client'; | ||
import { QueryHookOptions, QueryHookResult } from './types'; | ||
export default function useQuery<Data = any, Variables = OperationVariables, DeepPartial = {}>(queryOrAsyncQuery: DocumentNode<Data, Variables, DeepPartial> | AsyncDocumentNode<Data, Variables, DeepPartial>, ...optionsPart: IfAllNullableKeys<Variables, [ | ||
export default function useQuery<Data extends {} = any, Variables extends OperationVariables = OperationVariables, DeepPartial extends {} = {}>(queryOrAsyncQuery: DocumentNode<Data, Variables, DeepPartial> | AsyncDocumentNode<Data, Variables, DeepPartial>, ...optionsPart: IfAllNullableKeys<Variables, [ | ||
QueryHookOptions<Data, NoInfer<Variables>>? | ||
@@ -9,0 +9,0 @@ ], [ |
@@ -6,3 +6,3 @@ import { ApolloClient, MutationOptions as ClientMutationOptions } from 'apollo-client'; | ||
import { VariableOptions } from '../types'; | ||
export declare type QueryHookOptions<Data = any, Variables = OperationVariables> = Omit<QueryOptions<Data, Variables>, 'query' | 'partialRefetch' | 'children' | 'variables'> & VariableOptions<Variables> & { | ||
export type QueryHookOptions<Data = any, Variables = OperationVariables> = Omit<QueryOptions<Data, Variables>, 'query' | 'partialRefetch' | 'children' | 'variables'> & VariableOptions<Variables> & { | ||
skip?: boolean; | ||
@@ -14,6 +14,6 @@ }; | ||
} | ||
export declare type MutationHookOptions<Data = any, Variables = OperationVariables> = Omit<MutationOptions<Data, Variables>, 'variables' | 'mutation' | 'fetchPolicy'> & VariableOptions<Variables> & Pick<ClientMutationOptions<Data, Variables>, 'fetchPolicy'> & { | ||
export type MutationHookOptions<Data = any, Variables = OperationVariables> = Omit<MutationOptions<Data, Variables>, 'variables' | 'mutation' | 'fetchPolicy'> & VariableOptions<Variables> & Pick<ClientMutationOptions<Data, Variables>, 'fetchPolicy'> & { | ||
client?: ApolloClient<object>; | ||
}; | ||
export declare type MutationHookResult<Data, Variables> = (...optionsPart: IfAllNullableKeys<Variables, [ | ||
export type MutationHookResult<Data, Variables> = (...optionsPart: IfAllNullableKeys<Variables, [ | ||
MutationHookOptions<Data, Variables>? | ||
@@ -20,0 +20,0 @@ ], [ |
/// <reference types="react" /> | ||
import { QueryProps } from './types'; | ||
export declare type Props<T> = Pick<QueryProps<T>, 'query' | 'variables' | 'onError' | 'onCompleted' | 'pollInterval'> & { | ||
export type Props<T> = Pick<QueryProps<T>, 'query' | 'variables' | 'onError' | 'onCompleted' | 'pollInterval'> & { | ||
ignoreCache?: boolean; | ||
}; | ||
export declare function Prefetch<T>({ ignoreCache, ...props }: Props<T>): JSX.Element; | ||
export declare function Prefetch<T extends {}>({ ignoreCache, ...props }: Props<T>): JSX.Element; | ||
//# sourceMappingURL=Prefetch.d.ts.map |
@@ -9,4 +9,4 @@ /// <reference types="react" /> | ||
} | ||
export declare function Query<Data = any, Variables = OperationVariables>({ children, query, ...options }: QueryComponentOptions<Data, Variables>): JSX.Element | null; | ||
export declare function Query<Data extends {} = any, Variables extends OperationVariables = OperationVariables>({ children, query, ...options }: QueryComponentOptions<Data, Variables>): JSX.Element | null; | ||
export {}; | ||
//# sourceMappingURL=Query.d.ts.map |
@@ -9,3 +9,3 @@ import React from 'react'; | ||
export type { GraphQLData, GraphQLVariables, GraphQLDeepPartial, GraphQLOperation, }; | ||
export declare type VariableOptions<Variables> = IfEmptyObject<Variables, { | ||
export type VariableOptions<Variables> = IfEmptyObject<Variables, { | ||
variables?: never; | ||
@@ -17,3 +17,3 @@ }, IfAllNullableKeys<Variables, { | ||
}>>; | ||
export declare type QueryProps<Data = any, Variables = OperationVariables> = { | ||
export type QueryProps<Data = any, Variables = OperationVariables> = { | ||
children: (result: QueryResult<Data, Variables>) => React.ReactNode; | ||
@@ -20,0 +20,0 @@ fetchPolicy?: WatchQueryFetchPolicy; |
{ | ||
"name": "@shopify/react-graphql", | ||
"version": "0.0.0-snapshot-20230203161211", | ||
"version": "0.0.0-snapshot-20230206191454", | ||
"license": "MIT", | ||
@@ -30,5 +30,6 @@ "description": "Tools for creating type-safe and asynchronous GraphQL components for React", | ||
"@shopify/async": "^4.0.1", | ||
"@shopify/react-async": "0.0.0-snapshot-20230203161211", | ||
"@shopify/react-async": "0.0.0-snapshot-20230206191454", | ||
"@shopify/react-effect": "^5.0.2", | ||
"@shopify/react-idle": "^3.0.3", | ||
"@shopify/react-hooks": "^3.0.2", | ||
"@shopify/react-idle": "0.0.0-snapshot-20230206191454", | ||
"@shopify/useful-types": "^5.1.1", | ||
@@ -42,3 +43,3 @@ "apollo-cache-inmemory": ">=1.0.0 <2.0.0", | ||
"devDependencies": { | ||
"@shopify/react-testing": "0.0.0-snapshot-20230203161211" | ||
"@shopify/react-testing": "0.0.0-snapshot-20230206191454" | ||
}, | ||
@@ -45,0 +46,0 @@ "files": [ |
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
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
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
87731
1220
14
+ Added@shopify/react-hooks@^3.0.2
+ Added@shopify/react-async@0.0.0-snapshot-20230206191454(transitive)
+ Added@shopify/react-hooks@3.2.0(transitive)
+ Added@shopify/react-idle@0.0.0-snapshot-20230206191454(transitive)
- Removed@shopify/react-async@0.0.0-snapshot-20230203161211(transitive)
- Removed@shopify/react-idle@3.2.0(transitive)