Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use FetchPolicy in useLazyLoadQuery #97

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions change/@nova-react-926b307e-8fb5-4b68-b01a-7c369389c6a1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Use FetchPolicy in useLazyLoadQuery",
"packageName": "@nova/react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
3 changes: 2 additions & 1 deletion packages/nova-react/src/graphql/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type {
OperationType,
PaginationFn,
RefetchFn,
FetchPolicy
} from "./types";

/**
Expand Down Expand Up @@ -60,7 +61,7 @@ import type {
export function useLazyLoadQuery<TQuery extends OperationType>(
query: GraphQLTaggedNode,
variables: TQuery["variables"],
options?: { fetchPolicy?: "cache-first"; context?: TQuery["context"] },
options?: { fetchPolicy?: FetchPolicy; context?: TQuery["context"] },
): { error?: Error; data?: TQuery["response"] } {
const graphql = useNovaGraphQL();
invariant(
Expand Down
2 changes: 1 addition & 1 deletion packages/nova-react/src/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export type PaginationFn = (
options?: RefetchOptions,
) => Disposable;

type FetchPolicy =
export type FetchPolicy =
| "store-or-network"
| "store-and-network"
| "network-only"
Expand Down
Loading