@swan-io/graphql-client
Advanced tools
Comparing version
@@ -1138,4 +1138,8 @@ 'use strict'; | ||
); | ||
const reset = react.useCallback(() => { | ||
setIsQuerying(false); | ||
setStableVariables(boxed.Option.None()); | ||
}, []); | ||
const asyncDataToExpose = isQuerying ? boxed.AsyncData.Loading() : asyncData; | ||
return [asyncDataToExpose, exposedRunQuery]; | ||
return [asyncDataToExpose, { query: exposedRunQuery, reset }]; | ||
}; | ||
@@ -1142,0 +1146,0 @@ exports.useMutation = (mutation) => { |
@@ -13,3 +13,6 @@ import { AsyncData, Result, Future } from '@swan-io/boxed'; | ||
AsyncData<Result<Data, ClientError>>, | ||
(variables: Variables) => Future<Result<Data, ClientError>> | ||
{ | ||
query: (variables: Variables) => Future<Result<Data, ClientError>>; | ||
reset: () => void; | ||
} | ||
]; | ||
@@ -16,0 +19,0 @@ declare const useDeferredQuery: <Data, Variables>(query: TypedDocumentNode<Data, Variables>, { optimize, debounce }?: DeferredQueryConfig) => DeferredQuery<Data, Variables>; |
{ | ||
"name": "@swan-io/graphql-client", | ||
"version": "0.1.0-alpha15", | ||
"version": "0.1.0-alpha17", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "A simple, typesafe GraphQL client for React", |
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
291483
0.32%2827
0.39%