From b5a7f64c30a645ca1ba99b59ba91a0a638be7848 Mon Sep 17 00:00:00 2001 From: Masaya Suzuki Date: Wed, 7 Aug 2024 15:12:55 -0700 Subject: [PATCH] feat(typescript-react-apollo): support useBackgroundQuery and useLoadableQuery Implement `useBackgroundQuery` and `useLoadableQuery` hooks for React Apollo. These APIs are added in 3.8.0 and 3.9.0 respectively. Suspense support in Apollo Client provides 5 new hooks as described in https://www.apollographql.com/docs/react/data/suspense/. `useSuspenseQuery` support was added in https://github.com/dotansimha/graphql-code-generator-community/pull/434. Among other 4 hooks, `useBackgroundQuery` and `useLoadableQuery` are the ones that take a GraphQL document as an argument like other existing hooks. The support for these hooks are added in this change. Other hooks, `useQueryRefHanders` and `useReadQuery` do not take a GraphQL document as an argument, so they do not need to be added as the generated code. Both take the return values of other hooks as an argument, and the types are inferred from it. Follow up to https://github.com/dotansimha/graphql-code-generator-community/issues/388. Fixes https://github.com/dotansimha/graphql-code-generator-community/issues/477. --- dev-test/githunt/flow.flow.js | 156 +++++------ .../types.reactApollo.customSuffix.tsx | 57 ++++ dev-test/githunt/types.reactApollo.hooks.tsx | 51 ++++ .../types.reactApollo.preResolveTypes.tsx | 51 ++++ dev-test/githunt/types.reactApollo.tsx | 51 ++++ dev-test/githunt/types.reactApollo.v2.tsx | 57 ++++ .../__generated__/HeroAndFriendsNames.tsx | 25 ++ .../star-wars/__generated__/HeroAppearsIn.tsx | 20 ++ .../star-wars/__generated__/HeroDetails.tsx | 18 ++ .../__generated__/HeroDetailsWithFragment.tsx | 27 ++ dev-test/star-wars/__generated__/HeroName.tsx | 15 + .../__generated__/HeroNameConditional.tsx | 54 ++++ .../HeroParentTypeDependentField.tsx | 27 ++ .../HeroTypeDependentAliasedField.tsx | 27 ++ .../__generated__/HumanWithNullWeight.tsx | 25 ++ .../star-wars/__generated__/TwoHeroes.tsx | 18 ++ dev-test/star-wars/types.refetchFn.tsx | 256 ++++++++++++++++++ dev-test/test-message/types.tsx | 18 ++ package.json | 1 + .../typescript/react-apollo/src/visitor.ts | 37 ++- .../__snapshots__/react-apollo.spec.ts.snap | 40 +++ 21 files changed, 952 insertions(+), 79 deletions(-) diff --git a/dev-test/githunt/flow.flow.js b/dev-test/githunt/flow.flow.js index d16ad4e84..112254a51 100644 --- a/dev-test/githunt/flow.flow.js +++ b/dev-test/githunt/flow.flow.js @@ -176,21 +176,21 @@ export type OnCommentAddedSubscriptionVariables = { repoFullName: $ElementType, }; -export type OnCommentAddedSubscription = {| +export type OnCommentAddedSubscription = { ...{ __typename?: 'Subscription' }, ...{| - commentAdded?: ?{| + commentAdded?: ?{ ...{ __typename?: 'Comment' }, ...$Pick, ...{| - postedBy: {| + postedBy: { ...{ __typename?: 'User' }, ...$Pick, - |}, + }, |}, - |}, + }, |}, -|}; +}; export type CommentQueryVariables = { repoFullName: $ElementType, @@ -198,32 +198,32 @@ export type CommentQueryVariables = { offset?: ?$ElementType, }; -export type CommentQuery = {| +export type CommentQuery = { ...{ __typename?: 'Query' }, ...{| - currentUser?: ?{| + currentUser?: ?{ ...{ __typename?: 'User' }, ...$Pick, - |}, - entry?: ?{| + }, + entry?: ?{ ...{ __typename?: 'Entry' }, ...$Pick, ...{| - postedBy: {| + postedBy: { ...{ __typename?: 'User' }, ...$Pick, - |}, - comments: Array, ...{| - postedBy: {| + postedBy: { ...{ __typename?: 'User' }, ...$Pick, - |}, + }, |}, - |}>, - repository: {| + }>, + repository: { ...{ __typename?: 'Repository' }, ...$Pick< Repository, @@ -235,40 +235,40 @@ export type CommentQuery = {| html_url: *, |}, >, - |}, + }, |}, - |}, + }, |}, -|}; +}; -export type CommentsPageCommentFragment = {| +export type CommentsPageCommentFragment = { ...{ __typename?: 'Comment' }, ...$Pick, ...{| - postedBy: {| + postedBy: { ...{ __typename?: 'User' }, ...$Pick, - |}, + }, |}, -|}; +}; export type CurrentUserForProfileQueryVariables = {}; -export type CurrentUserForProfileQuery = {| +export type CurrentUserForProfileQuery = { ...{ __typename?: 'Query' }, ...{| - currentUser?: ?{| + currentUser?: ?{ ...{ __typename?: 'User' }, ...$Pick, - |}, + }, |}, -|}; +}; -export type FeedEntryFragment = {| +export type FeedEntryFragment = { ...{ __typename?: 'Entry' }, ...$Pick, ...{| - repository: {| + repository: { ...{ __typename?: 'Repository' }, ...$Pick< Repository, @@ -281,22 +281,22 @@ export type FeedEntryFragment = {| |}, >, ...{| - owner?: ?{| + owner?: ?{ ...{ __typename?: 'User' }, ...$Pick, - |}, + }, |}, - |}, - vote: {| + }, + vote: { ...{ __typename?: 'Vote' }, ...$Pick, - |}, - postedBy: {| + }, + postedBy: { ...{ __typename?: 'User' }, ...$Pick, - |}, + }, |}, -|}; +}; export type FeedQueryVariables = { type: FeedType, @@ -304,18 +304,18 @@ export type FeedQueryVariables = { limit?: ?$ElementType, }; -export type FeedQuery = {| +export type FeedQuery = { ...{ __typename?: 'Query' }, ...{| - currentUser?: ?{| + currentUser?: ?{ ...{ __typename?: 'User' }, ...$Pick, - |}, - feed?: ?Array, ...{| - repository: {| + repository: { ...{ __typename?: 'Repository' }, ...$Pick< Repository, @@ -328,103 +328,103 @@ export type FeedQuery = {| |}, >, ...{| - owner?: ?{| + owner?: ?{ ...{ __typename?: 'User' }, ...$Pick, - |}, + }, |}, - |}, - vote: {| + }, + vote: { ...{ __typename?: 'Vote' }, ...$Pick, - |}, - postedBy: {| + }, + postedBy: { ...{ __typename?: 'User' }, ...$Pick, - |}, + }, |}, - |}>, + }>, |}, -|}; +}; export type SubmitRepositoryMutationVariables = { repoFullName: $ElementType, }; -export type SubmitRepositoryMutation = {| +export type SubmitRepositoryMutation = { ...{ __typename?: 'Mutation' }, ...{| - submitRepository?: ?{| + submitRepository?: ?{ ...{ __typename?: 'Entry' }, ...$Pick, - |}, + }, |}, -|}; +}; -export type RepoInfoFragment = {| +export type RepoInfoFragment = { ...{ __typename?: 'Entry' }, ...$Pick, ...{| - repository: {| + repository: { ...{ __typename?: 'Repository' }, ...$Pick, - |}, - postedBy: {| + }, + postedBy: { ...{ __typename?: 'User' }, ...$Pick, - |}, + }, |}, -|}; +}; export type SubmitCommentMutationVariables = { repoFullName: $ElementType, commentContent: $ElementType, }; -export type SubmitCommentMutation = {| +export type SubmitCommentMutation = { ...{ __typename?: 'Mutation' }, ...{| - submitComment?: ?{| + submitComment?: ?{ ...{ __typename?: 'Comment' }, ...$Pick, ...{| - postedBy: {| + postedBy: { ...{ __typename?: 'User' }, ...$Pick, - |}, + }, |}, - |}, + }, |}, -|}; +}; -export type VoteButtonsFragment = {| +export type VoteButtonsFragment = { ...{ __typename?: 'Entry' }, ...$Pick, ...{| - vote: {| + vote: { ...{ __typename?: 'Vote' }, ...$Pick, - |}, + }, |}, -|}; +}; export type VoteMutationVariables = { repoFullName: $ElementType, type: VoteType, }; -export type VoteMutation = {| +export type VoteMutation = { ...{ __typename?: 'Mutation' }, ...{| - vote?: ?{| + vote?: ?{ ...{ __typename?: 'Entry' }, ...$Pick, ...{| - vote: {| + vote: { ...{ __typename?: 'Vote' }, ...$Pick, - |}, + }, |}, - |}, + }, |}, -|}; +}; diff --git a/dev-test/githunt/types.reactApollo.customSuffix.tsx b/dev-test/githunt/types.reactApollo.customSuffix.tsx index a8e7ed9a0..c6046bf88 100644 --- a/dev-test/githunt/types.reactApollo.customSuffix.tsx +++ b/dev-test/githunt/types.reactApollo.customSuffix.tsx @@ -509,9 +509,27 @@ export function useCommentSuspenseQuery( options, ); } +export function useCommentBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery( + CommentDocument, + options, + ); +} +export function useCommentLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery( + CommentDocument, + options, + ); +} export type CommentQueryHookResult = ReturnType; export type CommentLazyQueryHookResult = ReturnType; export type CommentSuspenseQueryHookResult = ReturnType; +export type CommentBackgroundQueryHookResult = ReturnType; +export type CommentLoadableQueryHookResult = ReturnType; export type CommentQueryResult = Apollo.QueryResult; export const CurrentUserForProfileDocument = gql` query CurrentUserForProfile { @@ -573,6 +591,27 @@ export function useCurrentUserForProfileSuspenseQuery( CurrentUserForProfileQueryVariables >(CurrentUserForProfileDocument, options); } +export function useCurrentUserForProfileBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + CurrentUserForProfileQueryMyOperation, + CurrentUserForProfileQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery< + CurrentUserForProfileQueryMyOperation, + CurrentUserForProfileQueryVariables + >(CurrentUserForProfileDocument, options); +} +export function useCurrentUserForProfileLoadableQuery( + baseOptions?: Apollo.LoadableQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery< + CurrentUserForProfileQueryMyOperation, + CurrentUserForProfileQueryVariables + >(CurrentUserForProfileDocument, options); +} export type CurrentUserForProfileQueryHookResult = ReturnType; export type CurrentUserForProfileLazyQueryHookResult = ReturnType< typeof useCurrentUserForProfileLazyQuery @@ -580,6 +619,12 @@ export type CurrentUserForProfileLazyQueryHookResult = ReturnType< export type CurrentUserForProfileSuspenseQueryHookResult = ReturnType< typeof useCurrentUserForProfileSuspenseQuery >; +export type CurrentUserForProfileBackgroundQueryHookResult = ReturnType< + typeof useCurrentUserForProfileBackgroundQuery +>; +export type CurrentUserForProfileLoadableQueryHookResult = ReturnType< + typeof useCurrentUserForProfileLoadableQuery +>; export type CurrentUserForProfileQueryResult = Apollo.QueryResult< CurrentUserForProfileQueryMyOperation, CurrentUserForProfileQueryVariables @@ -633,9 +678,21 @@ export function useFeedSuspenseQuery( const options = { ...defaultOptions, ...baseOptions }; return Apollo.useSuspenseQuery(FeedDocument, options); } +export function useFeedBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery(FeedDocument, options); +} +export function useFeedLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery(FeedDocument, options); +} export type FeedQueryHookResult = ReturnType; export type FeedLazyQueryHookResult = ReturnType; export type FeedSuspenseQueryHookResult = ReturnType; +export type FeedBackgroundQueryHookResult = ReturnType; +export type FeedLoadableQueryHookResult = ReturnType; export type FeedQueryResult = Apollo.QueryResult; export const SubmitRepositoryDocument = gql` mutation submitRepository($repoFullName: String!) { diff --git a/dev-test/githunt/types.reactApollo.hooks.tsx b/dev-test/githunt/types.reactApollo.hooks.tsx index d26973a7e..c85d72af1 100644 --- a/dev-test/githunt/types.reactApollo.hooks.tsx +++ b/dev-test/githunt/types.reactApollo.hooks.tsx @@ -549,9 +549,21 @@ export function useCommentSuspenseQuery( const options = { ...defaultOptions, ...baseOptions }; return Apollo.useSuspenseQuery(CommentDocument, options); } +export function useCommentBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery(CommentDocument, options); +} +export function useCommentLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery(CommentDocument, options); +} export type CommentQueryHookResult = ReturnType; export type CommentLazyQueryHookResult = ReturnType; export type CommentSuspenseQueryHookResult = ReturnType; +export type CommentBackgroundQueryHookResult = ReturnType; +export type CommentLoadableQueryHookResult = ReturnType; export type CommentQueryResult = Apollo.QueryResult; export const CurrentUserForProfileDocument = gql` query CurrentUserForProfile { @@ -613,6 +625,27 @@ export function useCurrentUserForProfileSuspenseQuery( options, ); } +export function useCurrentUserForProfileBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + CurrentUserForProfileQuery, + CurrentUserForProfileQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery( + CurrentUserForProfileDocument, + options, + ); +} +export function useCurrentUserForProfileLoadableQuery( + baseOptions?: Apollo.LoadableQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery( + CurrentUserForProfileDocument, + options, + ); +} export type CurrentUserForProfileQueryHookResult = ReturnType; export type CurrentUserForProfileLazyQueryHookResult = ReturnType< typeof useCurrentUserForProfileLazyQuery @@ -620,6 +653,12 @@ export type CurrentUserForProfileLazyQueryHookResult = ReturnType< export type CurrentUserForProfileSuspenseQueryHookResult = ReturnType< typeof useCurrentUserForProfileSuspenseQuery >; +export type CurrentUserForProfileBackgroundQueryHookResult = ReturnType< + typeof useCurrentUserForProfileBackgroundQuery +>; +export type CurrentUserForProfileLoadableQueryHookResult = ReturnType< + typeof useCurrentUserForProfileLoadableQuery +>; export type CurrentUserForProfileQueryResult = Apollo.QueryResult< CurrentUserForProfileQuery, CurrentUserForProfileQueryVariables @@ -673,9 +712,21 @@ export function useFeedSuspenseQuery( const options = { ...defaultOptions, ...baseOptions }; return Apollo.useSuspenseQuery(FeedDocument, options); } +export function useFeedBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery(FeedDocument, options); +} +export function useFeedLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery(FeedDocument, options); +} export type FeedQueryHookResult = ReturnType; export type FeedLazyQueryHookResult = ReturnType; export type FeedSuspenseQueryHookResult = ReturnType; +export type FeedBackgroundQueryHookResult = ReturnType; +export type FeedLoadableQueryHookResult = ReturnType; export type FeedQueryResult = Apollo.QueryResult; export const SubmitRepositoryDocument = gql` mutation submitRepository($repoFullName: String!) { diff --git a/dev-test/githunt/types.reactApollo.preResolveTypes.tsx b/dev-test/githunt/types.reactApollo.preResolveTypes.tsx index 06ba7df32..3754971d7 100644 --- a/dev-test/githunt/types.reactApollo.preResolveTypes.tsx +++ b/dev-test/githunt/types.reactApollo.preResolveTypes.tsx @@ -503,9 +503,21 @@ export function useCommentSuspenseQuery( const options = { ...defaultOptions, ...baseOptions }; return Apollo.useSuspenseQuery(CommentDocument, options); } +export function useCommentBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery(CommentDocument, options); +} +export function useCommentLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery(CommentDocument, options); +} export type CommentQueryHookResult = ReturnType; export type CommentLazyQueryHookResult = ReturnType; export type CommentSuspenseQueryHookResult = ReturnType; +export type CommentBackgroundQueryHookResult = ReturnType; +export type CommentLoadableQueryHookResult = ReturnType; export type CommentQueryResult = Apollo.QueryResult; export const CurrentUserForProfileDocument = gql` query CurrentUserForProfile { @@ -567,6 +579,27 @@ export function useCurrentUserForProfileSuspenseQuery( options, ); } +export function useCurrentUserForProfileBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + CurrentUserForProfileQuery, + CurrentUserForProfileQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery( + CurrentUserForProfileDocument, + options, + ); +} +export function useCurrentUserForProfileLoadableQuery( + baseOptions?: Apollo.LoadableQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery( + CurrentUserForProfileDocument, + options, + ); +} export type CurrentUserForProfileQueryHookResult = ReturnType; export type CurrentUserForProfileLazyQueryHookResult = ReturnType< typeof useCurrentUserForProfileLazyQuery @@ -574,6 +607,12 @@ export type CurrentUserForProfileLazyQueryHookResult = ReturnType< export type CurrentUserForProfileSuspenseQueryHookResult = ReturnType< typeof useCurrentUserForProfileSuspenseQuery >; +export type CurrentUserForProfileBackgroundQueryHookResult = ReturnType< + typeof useCurrentUserForProfileBackgroundQuery +>; +export type CurrentUserForProfileLoadableQueryHookResult = ReturnType< + typeof useCurrentUserForProfileLoadableQuery +>; export type CurrentUserForProfileQueryResult = Apollo.QueryResult< CurrentUserForProfileQuery, CurrentUserForProfileQueryVariables @@ -627,9 +666,21 @@ export function useFeedSuspenseQuery( const options = { ...defaultOptions, ...baseOptions }; return Apollo.useSuspenseQuery(FeedDocument, options); } +export function useFeedBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery(FeedDocument, options); +} +export function useFeedLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery(FeedDocument, options); +} export type FeedQueryHookResult = ReturnType; export type FeedLazyQueryHookResult = ReturnType; export type FeedSuspenseQueryHookResult = ReturnType; +export type FeedBackgroundQueryHookResult = ReturnType; +export type FeedLoadableQueryHookResult = ReturnType; export type FeedQueryResult = Apollo.QueryResult; export const SubmitRepositoryDocument = gql` mutation submitRepository($repoFullName: String!) { diff --git a/dev-test/githunt/types.reactApollo.tsx b/dev-test/githunt/types.reactApollo.tsx index 06ba7df32..3754971d7 100644 --- a/dev-test/githunt/types.reactApollo.tsx +++ b/dev-test/githunt/types.reactApollo.tsx @@ -503,9 +503,21 @@ export function useCommentSuspenseQuery( const options = { ...defaultOptions, ...baseOptions }; return Apollo.useSuspenseQuery(CommentDocument, options); } +export function useCommentBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery(CommentDocument, options); +} +export function useCommentLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery(CommentDocument, options); +} export type CommentQueryHookResult = ReturnType; export type CommentLazyQueryHookResult = ReturnType; export type CommentSuspenseQueryHookResult = ReturnType; +export type CommentBackgroundQueryHookResult = ReturnType; +export type CommentLoadableQueryHookResult = ReturnType; export type CommentQueryResult = Apollo.QueryResult; export const CurrentUserForProfileDocument = gql` query CurrentUserForProfile { @@ -567,6 +579,27 @@ export function useCurrentUserForProfileSuspenseQuery( options, ); } +export function useCurrentUserForProfileBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + CurrentUserForProfileQuery, + CurrentUserForProfileQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery( + CurrentUserForProfileDocument, + options, + ); +} +export function useCurrentUserForProfileLoadableQuery( + baseOptions?: Apollo.LoadableQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery( + CurrentUserForProfileDocument, + options, + ); +} export type CurrentUserForProfileQueryHookResult = ReturnType; export type CurrentUserForProfileLazyQueryHookResult = ReturnType< typeof useCurrentUserForProfileLazyQuery @@ -574,6 +607,12 @@ export type CurrentUserForProfileLazyQueryHookResult = ReturnType< export type CurrentUserForProfileSuspenseQueryHookResult = ReturnType< typeof useCurrentUserForProfileSuspenseQuery >; +export type CurrentUserForProfileBackgroundQueryHookResult = ReturnType< + typeof useCurrentUserForProfileBackgroundQuery +>; +export type CurrentUserForProfileLoadableQueryHookResult = ReturnType< + typeof useCurrentUserForProfileLoadableQuery +>; export type CurrentUserForProfileQueryResult = Apollo.QueryResult< CurrentUserForProfileQuery, CurrentUserForProfileQueryVariables @@ -627,9 +666,21 @@ export function useFeedSuspenseQuery( const options = { ...defaultOptions, ...baseOptions }; return Apollo.useSuspenseQuery(FeedDocument, options); } +export function useFeedBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery(FeedDocument, options); +} +export function useFeedLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery(FeedDocument, options); +} export type FeedQueryHookResult = ReturnType; export type FeedLazyQueryHookResult = ReturnType; export type FeedSuspenseQueryHookResult = ReturnType; +export type FeedBackgroundQueryHookResult = ReturnType; +export type FeedLoadableQueryHookResult = ReturnType; export type FeedQueryResult = Apollo.QueryResult; export const SubmitRepositoryDocument = gql` mutation submitRepository($repoFullName: String!) { diff --git a/dev-test/githunt/types.reactApollo.v2.tsx b/dev-test/githunt/types.reactApollo.v2.tsx index d601cd4c5..0dc8953bf 100644 --- a/dev-test/githunt/types.reactApollo.v2.tsx +++ b/dev-test/githunt/types.reactApollo.v2.tsx @@ -510,9 +510,27 @@ export function useCommentSuspenseQuery( options, ); } +export function useCommentBackgroundQuery( + baseOptions?: ApolloReactHooks.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return ApolloReactHooks.useBackgroundQuery( + CommentDocument, + options, + ); +} +export function useCommentLoadableQuery(baseOptions?: ApolloReactHooks.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return ApolloReactHooks.useLoadableQuery( + CommentDocument, + options, + ); +} export type CommentQueryHookResult = ReturnType; export type CommentLazyQueryHookResult = ReturnType; export type CommentSuspenseQueryHookResult = ReturnType; +export type CommentBackgroundQueryHookResult = ReturnType; +export type CommentLoadableQueryHookResult = ReturnType; export type CommentQueryResult = ApolloReactCommon.QueryResult; export const CurrentUserForProfileDocument = gql` query CurrentUserForProfile { @@ -574,6 +592,27 @@ export function useCurrentUserForProfileSuspenseQuery( CurrentUserForProfileQueryVariables >(CurrentUserForProfileDocument, options); } +export function useCurrentUserForProfileBackgroundQuery( + baseOptions?: ApolloReactHooks.BackgroundQueryHookOptions< + CurrentUserForProfileQuery, + CurrentUserForProfileQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return ApolloReactHooks.useBackgroundQuery< + CurrentUserForProfileQuery, + CurrentUserForProfileQueryVariables + >(CurrentUserForProfileDocument, options); +} +export function useCurrentUserForProfileLoadableQuery( + baseOptions?: ApolloReactHooks.LoadableQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return ApolloReactHooks.useLoadableQuery< + CurrentUserForProfileQuery, + CurrentUserForProfileQueryVariables + >(CurrentUserForProfileDocument, options); +} export type CurrentUserForProfileQueryHookResult = ReturnType; export type CurrentUserForProfileLazyQueryHookResult = ReturnType< typeof useCurrentUserForProfileLazyQuery @@ -581,6 +620,12 @@ export type CurrentUserForProfileLazyQueryHookResult = ReturnType< export type CurrentUserForProfileSuspenseQueryHookResult = ReturnType< typeof useCurrentUserForProfileSuspenseQuery >; +export type CurrentUserForProfileBackgroundQueryHookResult = ReturnType< + typeof useCurrentUserForProfileBackgroundQuery +>; +export type CurrentUserForProfileLoadableQueryHookResult = ReturnType< + typeof useCurrentUserForProfileLoadableQuery +>; export type CurrentUserForProfileQueryResult = ApolloReactCommon.QueryResult< CurrentUserForProfileQuery, CurrentUserForProfileQueryVariables @@ -634,9 +679,21 @@ export function useFeedSuspenseQuery( const options = { ...defaultOptions, ...baseOptions }; return ApolloReactHooks.useSuspenseQuery(FeedDocument, options); } +export function useFeedBackgroundQuery( + baseOptions?: ApolloReactHooks.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return ApolloReactHooks.useBackgroundQuery(FeedDocument, options); +} +export function useFeedLoadableQuery(baseOptions?: ApolloReactHooks.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return ApolloReactHooks.useLoadableQuery(FeedDocument, options); +} export type FeedQueryHookResult = ReturnType; export type FeedLazyQueryHookResult = ReturnType; export type FeedSuspenseQueryHookResult = ReturnType; +export type FeedBackgroundQueryHookResult = ReturnType; +export type FeedLoadableQueryHookResult = ReturnType; export type FeedQueryResult = ApolloReactCommon.QueryResult; export const SubmitRepositoryDocument = gql` mutation submitRepository($repoFullName: String!) { diff --git a/dev-test/star-wars/__generated__/HeroAndFriendsNames.tsx b/dev-test/star-wars/__generated__/HeroAndFriendsNames.tsx index 56897ff38..10959df44 100644 --- a/dev-test/star-wars/__generated__/HeroAndFriendsNames.tsx +++ b/dev-test/star-wars/__generated__/HeroAndFriendsNames.tsx @@ -90,6 +90,25 @@ export function useHeroAndFriendsNamesSuspenseQuery( options, ); } +export function useHeroAndFriendsNamesBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + HeroAndFriendsNamesQuery, + HeroAndFriendsNamesQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery( + HeroAndFriendsNamesDocument, + options, + ); +} +export function useHeroAndFriendsNamesLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery( + HeroAndFriendsNamesDocument, + options, + ); +} export type HeroAndFriendsNamesQueryHookResult = ReturnType; export type HeroAndFriendsNamesLazyQueryHookResult = ReturnType< typeof useHeroAndFriendsNamesLazyQuery @@ -97,6 +116,12 @@ export type HeroAndFriendsNamesLazyQueryHookResult = ReturnType< export type HeroAndFriendsNamesSuspenseQueryHookResult = ReturnType< typeof useHeroAndFriendsNamesSuspenseQuery >; +export type HeroAndFriendsNamesBackgroundQueryHookResult = ReturnType< + typeof useHeroAndFriendsNamesBackgroundQuery +>; +export type HeroAndFriendsNamesLoadableQueryHookResult = ReturnType< + typeof useHeroAndFriendsNamesLoadableQuery +>; export type HeroAndFriendsNamesQueryResult = Apollo.QueryResult< HeroAndFriendsNamesQuery, HeroAndFriendsNamesQueryVariables diff --git a/dev-test/star-wars/__generated__/HeroAppearsIn.tsx b/dev-test/star-wars/__generated__/HeroAppearsIn.tsx index 2936042c6..702a20523 100644 --- a/dev-test/star-wars/__generated__/HeroAppearsIn.tsx +++ b/dev-test/star-wars/__generated__/HeroAppearsIn.tsx @@ -64,9 +64,29 @@ export function useHeroAppearsInSuspenseQuery( options, ); } +export function useHeroAppearsInBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery( + HeroAppearsInDocument, + options, + ); +} +export function useHeroAppearsInLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery( + HeroAppearsInDocument, + options, + ); +} export type HeroAppearsInQueryHookResult = ReturnType; export type HeroAppearsInLazyQueryHookResult = ReturnType; export type HeroAppearsInSuspenseQueryHookResult = ReturnType; +export type HeroAppearsInBackgroundQueryHookResult = ReturnType< + typeof useHeroAppearsInBackgroundQuery +>; +export type HeroAppearsInLoadableQueryHookResult = ReturnType; export type HeroAppearsInQueryResult = Apollo.QueryResult< HeroAppearsInQuery, HeroAppearsInQueryVariables diff --git a/dev-test/star-wars/__generated__/HeroDetails.tsx b/dev-test/star-wars/__generated__/HeroDetails.tsx index 9a57ccf0b..9561e2f0c 100644 --- a/dev-test/star-wars/__generated__/HeroDetails.tsx +++ b/dev-test/star-wars/__generated__/HeroDetails.tsx @@ -69,9 +69,27 @@ export function useHeroDetailsSuspenseQuery( options, ); } +export function useHeroDetailsBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery( + HeroDetailsDocument, + options, + ); +} +export function useHeroDetailsLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery( + HeroDetailsDocument, + options, + ); +} export type HeroDetailsQueryHookResult = ReturnType; export type HeroDetailsLazyQueryHookResult = ReturnType; export type HeroDetailsSuspenseQueryHookResult = ReturnType; +export type HeroDetailsBackgroundQueryHookResult = ReturnType; +export type HeroDetailsLoadableQueryHookResult = ReturnType; export type HeroDetailsQueryResult = Apollo.QueryResult< HeroDetailsQuery, HeroDetailsQueryVariables diff --git a/dev-test/star-wars/__generated__/HeroDetailsWithFragment.tsx b/dev-test/star-wars/__generated__/HeroDetailsWithFragment.tsx index 451616bed..d68119c07 100644 --- a/dev-test/star-wars/__generated__/HeroDetailsWithFragment.tsx +++ b/dev-test/star-wars/__generated__/HeroDetailsWithFragment.tsx @@ -77,6 +77,27 @@ export function useHeroDetailsWithFragmentSuspenseQuery( HeroDetailsWithFragmentQueryVariables >(HeroDetailsWithFragmentDocument, options); } +export function useHeroDetailsWithFragmentBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + HeroDetailsWithFragmentQuery, + HeroDetailsWithFragmentQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery< + HeroDetailsWithFragmentQuery, + HeroDetailsWithFragmentQueryVariables + >(HeroDetailsWithFragmentDocument, options); +} +export function useHeroDetailsWithFragmentLoadableQuery( + baseOptions?: Apollo.LoadableQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery< + HeroDetailsWithFragmentQuery, + HeroDetailsWithFragmentQueryVariables + >(HeroDetailsWithFragmentDocument, options); +} export type HeroDetailsWithFragmentQueryHookResult = ReturnType< typeof useHeroDetailsWithFragmentQuery >; @@ -86,6 +107,12 @@ export type HeroDetailsWithFragmentLazyQueryHookResult = ReturnType< export type HeroDetailsWithFragmentSuspenseQueryHookResult = ReturnType< typeof useHeroDetailsWithFragmentSuspenseQuery >; +export type HeroDetailsWithFragmentBackgroundQueryHookResult = ReturnType< + typeof useHeroDetailsWithFragmentBackgroundQuery +>; +export type HeroDetailsWithFragmentLoadableQueryHookResult = ReturnType< + typeof useHeroDetailsWithFragmentLoadableQuery +>; export type HeroDetailsWithFragmentQueryResult = Apollo.QueryResult< HeroDetailsWithFragmentQuery, HeroDetailsWithFragmentQueryVariables diff --git a/dev-test/star-wars/__generated__/HeroName.tsx b/dev-test/star-wars/__generated__/HeroName.tsx index 984f5581e..7dd95e638 100644 --- a/dev-test/star-wars/__generated__/HeroName.tsx +++ b/dev-test/star-wars/__generated__/HeroName.tsx @@ -54,7 +54,22 @@ export function useHeroNameSuspenseQuery( const options = { ...defaultOptions, ...baseOptions }; return Apollo.useSuspenseQuery(HeroNameDocument, options); } +export function useHeroNameBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery( + HeroNameDocument, + options, + ); +} +export function useHeroNameLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery(HeroNameDocument, options); +} export type HeroNameQueryHookResult = ReturnType; export type HeroNameLazyQueryHookResult = ReturnType; export type HeroNameSuspenseQueryHookResult = ReturnType; +export type HeroNameBackgroundQueryHookResult = ReturnType; +export type HeroNameLoadableQueryHookResult = ReturnType; export type HeroNameQueryResult = Apollo.QueryResult; diff --git a/dev-test/star-wars/__generated__/HeroNameConditional.tsx b/dev-test/star-wars/__generated__/HeroNameConditional.tsx index 00df11e9c..e8d14f03c 100644 --- a/dev-test/star-wars/__generated__/HeroNameConditional.tsx +++ b/dev-test/star-wars/__generated__/HeroNameConditional.tsx @@ -85,6 +85,27 @@ export function useHeroNameConditionalInclusionSuspenseQuery( HeroNameConditionalInclusionQueryVariables >(HeroNameConditionalInclusionDocument, options); } +export function useHeroNameConditionalInclusionBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + HeroNameConditionalInclusionQuery, + HeroNameConditionalInclusionQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery< + HeroNameConditionalInclusionQuery, + HeroNameConditionalInclusionQueryVariables + >(HeroNameConditionalInclusionDocument, options); +} +export function useHeroNameConditionalInclusionLoadableQuery( + baseOptions?: Apollo.LoadableQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery< + HeroNameConditionalInclusionQuery, + HeroNameConditionalInclusionQueryVariables + >(HeroNameConditionalInclusionDocument, options); +} export type HeroNameConditionalInclusionQueryHookResult = ReturnType< typeof useHeroNameConditionalInclusionQuery >; @@ -94,6 +115,12 @@ export type HeroNameConditionalInclusionLazyQueryHookResult = ReturnType< export type HeroNameConditionalInclusionSuspenseQueryHookResult = ReturnType< typeof useHeroNameConditionalInclusionSuspenseQuery >; +export type HeroNameConditionalInclusionBackgroundQueryHookResult = ReturnType< + typeof useHeroNameConditionalInclusionBackgroundQuery +>; +export type HeroNameConditionalInclusionLoadableQueryHookResult = ReturnType< + typeof useHeroNameConditionalInclusionLoadableQuery +>; export type HeroNameConditionalInclusionQueryResult = Apollo.QueryResult< HeroNameConditionalInclusionQuery, HeroNameConditionalInclusionQueryVariables @@ -160,6 +187,27 @@ export function useHeroNameConditionalExclusionSuspenseQuery( HeroNameConditionalExclusionQueryVariables >(HeroNameConditionalExclusionDocument, options); } +export function useHeroNameConditionalExclusionBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + HeroNameConditionalExclusionQuery, + HeroNameConditionalExclusionQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery< + HeroNameConditionalExclusionQuery, + HeroNameConditionalExclusionQueryVariables + >(HeroNameConditionalExclusionDocument, options); +} +export function useHeroNameConditionalExclusionLoadableQuery( + baseOptions?: Apollo.LoadableQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery< + HeroNameConditionalExclusionQuery, + HeroNameConditionalExclusionQueryVariables + >(HeroNameConditionalExclusionDocument, options); +} export type HeroNameConditionalExclusionQueryHookResult = ReturnType< typeof useHeroNameConditionalExclusionQuery >; @@ -169,6 +217,12 @@ export type HeroNameConditionalExclusionLazyQueryHookResult = ReturnType< export type HeroNameConditionalExclusionSuspenseQueryHookResult = ReturnType< typeof useHeroNameConditionalExclusionSuspenseQuery >; +export type HeroNameConditionalExclusionBackgroundQueryHookResult = ReturnType< + typeof useHeroNameConditionalExclusionBackgroundQuery +>; +export type HeroNameConditionalExclusionLoadableQueryHookResult = ReturnType< + typeof useHeroNameConditionalExclusionLoadableQuery +>; export type HeroNameConditionalExclusionQueryResult = Apollo.QueryResult< HeroNameConditionalExclusionQuery, HeroNameConditionalExclusionQueryVariables diff --git a/dev-test/star-wars/__generated__/HeroParentTypeDependentField.tsx b/dev-test/star-wars/__generated__/HeroParentTypeDependentField.tsx index 37ae1d3a7..4b088d495 100644 --- a/dev-test/star-wars/__generated__/HeroParentTypeDependentField.tsx +++ b/dev-test/star-wars/__generated__/HeroParentTypeDependentField.tsx @@ -107,6 +107,27 @@ export function useHeroParentTypeDependentFieldSuspenseQuery( HeroParentTypeDependentFieldQueryVariables >(HeroParentTypeDependentFieldDocument, options); } +export function useHeroParentTypeDependentFieldBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + HeroParentTypeDependentFieldQuery, + HeroParentTypeDependentFieldQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery< + HeroParentTypeDependentFieldQuery, + HeroParentTypeDependentFieldQueryVariables + >(HeroParentTypeDependentFieldDocument, options); +} +export function useHeroParentTypeDependentFieldLoadableQuery( + baseOptions?: Apollo.LoadableQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery< + HeroParentTypeDependentFieldQuery, + HeroParentTypeDependentFieldQueryVariables + >(HeroParentTypeDependentFieldDocument, options); +} export type HeroParentTypeDependentFieldQueryHookResult = ReturnType< typeof useHeroParentTypeDependentFieldQuery >; @@ -116,6 +137,12 @@ export type HeroParentTypeDependentFieldLazyQueryHookResult = ReturnType< export type HeroParentTypeDependentFieldSuspenseQueryHookResult = ReturnType< typeof useHeroParentTypeDependentFieldSuspenseQuery >; +export type HeroParentTypeDependentFieldBackgroundQueryHookResult = ReturnType< + typeof useHeroParentTypeDependentFieldBackgroundQuery +>; +export type HeroParentTypeDependentFieldLoadableQueryHookResult = ReturnType< + typeof useHeroParentTypeDependentFieldLoadableQuery +>; export type HeroParentTypeDependentFieldQueryResult = Apollo.QueryResult< HeroParentTypeDependentFieldQuery, HeroParentTypeDependentFieldQueryVariables diff --git a/dev-test/star-wars/__generated__/HeroTypeDependentAliasedField.tsx b/dev-test/star-wars/__generated__/HeroTypeDependentAliasedField.tsx index 109b6e56a..0ad0de766 100644 --- a/dev-test/star-wars/__generated__/HeroTypeDependentAliasedField.tsx +++ b/dev-test/star-wars/__generated__/HeroTypeDependentAliasedField.tsx @@ -80,6 +80,27 @@ export function useHeroTypeDependentAliasedFieldSuspenseQuery( HeroTypeDependentAliasedFieldQueryVariables >(HeroTypeDependentAliasedFieldDocument, options); } +export function useHeroTypeDependentAliasedFieldBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + HeroTypeDependentAliasedFieldQuery, + HeroTypeDependentAliasedFieldQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery< + HeroTypeDependentAliasedFieldQuery, + HeroTypeDependentAliasedFieldQueryVariables + >(HeroTypeDependentAliasedFieldDocument, options); +} +export function useHeroTypeDependentAliasedFieldLoadableQuery( + baseOptions?: Apollo.LoadableQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery< + HeroTypeDependentAliasedFieldQuery, + HeroTypeDependentAliasedFieldQueryVariables + >(HeroTypeDependentAliasedFieldDocument, options); +} export type HeroTypeDependentAliasedFieldQueryHookResult = ReturnType< typeof useHeroTypeDependentAliasedFieldQuery >; @@ -89,6 +110,12 @@ export type HeroTypeDependentAliasedFieldLazyQueryHookResult = ReturnType< export type HeroTypeDependentAliasedFieldSuspenseQueryHookResult = ReturnType< typeof useHeroTypeDependentAliasedFieldSuspenseQuery >; +export type HeroTypeDependentAliasedFieldBackgroundQueryHookResult = ReturnType< + typeof useHeroTypeDependentAliasedFieldBackgroundQuery +>; +export type HeroTypeDependentAliasedFieldLoadableQueryHookResult = ReturnType< + typeof useHeroTypeDependentAliasedFieldLoadableQuery +>; export type HeroTypeDependentAliasedFieldQueryResult = Apollo.QueryResult< HeroTypeDependentAliasedFieldQuery, HeroTypeDependentAliasedFieldQueryVariables diff --git a/dev-test/star-wars/__generated__/HumanWithNullWeight.tsx b/dev-test/star-wars/__generated__/HumanWithNullWeight.tsx index 58a581582..64660c8f6 100644 --- a/dev-test/star-wars/__generated__/HumanWithNullWeight.tsx +++ b/dev-test/star-wars/__generated__/HumanWithNullWeight.tsx @@ -71,6 +71,25 @@ export function useHumanWithNullHeightSuspenseQuery( options, ); } +export function useHumanWithNullHeightBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + HumanWithNullHeightQuery, + HumanWithNullHeightQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery( + HumanWithNullHeightDocument, + options, + ); +} +export function useHumanWithNullHeightLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery( + HumanWithNullHeightDocument, + options, + ); +} export type HumanWithNullHeightQueryHookResult = ReturnType; export type HumanWithNullHeightLazyQueryHookResult = ReturnType< typeof useHumanWithNullHeightLazyQuery @@ -78,6 +97,12 @@ export type HumanWithNullHeightLazyQueryHookResult = ReturnType< export type HumanWithNullHeightSuspenseQueryHookResult = ReturnType< typeof useHumanWithNullHeightSuspenseQuery >; +export type HumanWithNullHeightBackgroundQueryHookResult = ReturnType< + typeof useHumanWithNullHeightBackgroundQuery +>; +export type HumanWithNullHeightLoadableQueryHookResult = ReturnType< + typeof useHumanWithNullHeightLoadableQuery +>; export type HumanWithNullHeightQueryResult = Apollo.QueryResult< HumanWithNullHeightQuery, HumanWithNullHeightQueryVariables diff --git a/dev-test/star-wars/__generated__/TwoHeroes.tsx b/dev-test/star-wars/__generated__/TwoHeroes.tsx index 0de6ee8cf..864b46981 100644 --- a/dev-test/star-wars/__generated__/TwoHeroes.tsx +++ b/dev-test/star-wars/__generated__/TwoHeroes.tsx @@ -58,7 +58,25 @@ export function useTwoHeroesSuspenseQuery( options, ); } +export function useTwoHeroesBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery( + TwoHeroesDocument, + options, + ); +} +export function useTwoHeroesLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery( + TwoHeroesDocument, + options, + ); +} export type TwoHeroesQueryHookResult = ReturnType; export type TwoHeroesLazyQueryHookResult = ReturnType; export type TwoHeroesSuspenseQueryHookResult = ReturnType; +export type TwoHeroesBackgroundQueryHookResult = ReturnType; +export type TwoHeroesLoadableQueryHookResult = ReturnType; export type TwoHeroesQueryResult = Apollo.QueryResult; diff --git a/dev-test/star-wars/types.refetchFn.tsx b/dev-test/star-wars/types.refetchFn.tsx index 250f84830..21cb613bb 100644 --- a/dev-test/star-wars/types.refetchFn.tsx +++ b/dev-test/star-wars/types.refetchFn.tsx @@ -374,6 +374,25 @@ export function useHeroAndFriendsNamesSuspenseQuery( options, ); } +export function useHeroAndFriendsNamesBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + HeroAndFriendsNamesQuery, + HeroAndFriendsNamesQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery( + HeroAndFriendsNamesDocument, + options, + ); +} +export function useHeroAndFriendsNamesLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery( + HeroAndFriendsNamesDocument, + options, + ); +} export type HeroAndFriendsNamesQueryHookResult = ReturnType; export type HeroAndFriendsNamesLazyQueryHookResult = ReturnType< typeof useHeroAndFriendsNamesLazyQuery @@ -381,6 +400,12 @@ export type HeroAndFriendsNamesLazyQueryHookResult = ReturnType< export type HeroAndFriendsNamesSuspenseQueryHookResult = ReturnType< typeof useHeroAndFriendsNamesSuspenseQuery >; +export type HeroAndFriendsNamesBackgroundQueryHookResult = ReturnType< + typeof useHeroAndFriendsNamesBackgroundQuery +>; +export type HeroAndFriendsNamesLoadableQueryHookResult = ReturnType< + typeof useHeroAndFriendsNamesLoadableQuery +>; export type HeroAndFriendsNamesQueryResult = Apollo.QueryResult< HeroAndFriendsNamesQuery, HeroAndFriendsNamesQueryVariables @@ -439,9 +464,29 @@ export function useHeroAppearsInSuspenseQuery( options, ); } +export function useHeroAppearsInBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery( + HeroAppearsInDocument, + options, + ); +} +export function useHeroAppearsInLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery( + HeroAppearsInDocument, + options, + ); +} export type HeroAppearsInQueryHookResult = ReturnType; export type HeroAppearsInLazyQueryHookResult = ReturnType; export type HeroAppearsInSuspenseQueryHookResult = ReturnType; +export type HeroAppearsInBackgroundQueryHookResult = ReturnType< + typeof useHeroAppearsInBackgroundQuery +>; +export type HeroAppearsInLoadableQueryHookResult = ReturnType; export type HeroAppearsInQueryResult = Apollo.QueryResult< HeroAppearsInQuery, HeroAppearsInQueryVariables @@ -503,9 +548,27 @@ export function useHeroDetailsSuspenseQuery( options, ); } +export function useHeroDetailsBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery( + HeroDetailsDocument, + options, + ); +} +export function useHeroDetailsLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery( + HeroDetailsDocument, + options, + ); +} export type HeroDetailsQueryHookResult = ReturnType; export type HeroDetailsLazyQueryHookResult = ReturnType; export type HeroDetailsSuspenseQueryHookResult = ReturnType; +export type HeroDetailsBackgroundQueryHookResult = ReturnType; +export type HeroDetailsLoadableQueryHookResult = ReturnType; export type HeroDetailsQueryResult = Apollo.QueryResult< HeroDetailsQuery, HeroDetailsQueryVariables @@ -574,6 +637,27 @@ export function useHeroDetailsWithFragmentSuspenseQuery( HeroDetailsWithFragmentQueryVariables >(HeroDetailsWithFragmentDocument, options); } +export function useHeroDetailsWithFragmentBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + HeroDetailsWithFragmentQuery, + HeroDetailsWithFragmentQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery< + HeroDetailsWithFragmentQuery, + HeroDetailsWithFragmentQueryVariables + >(HeroDetailsWithFragmentDocument, options); +} +export function useHeroDetailsWithFragmentLoadableQuery( + baseOptions?: Apollo.LoadableQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery< + HeroDetailsWithFragmentQuery, + HeroDetailsWithFragmentQueryVariables + >(HeroDetailsWithFragmentDocument, options); +} export type HeroDetailsWithFragmentQueryHookResult = ReturnType< typeof useHeroDetailsWithFragmentQuery >; @@ -583,6 +667,12 @@ export type HeroDetailsWithFragmentLazyQueryHookResult = ReturnType< export type HeroDetailsWithFragmentSuspenseQueryHookResult = ReturnType< typeof useHeroDetailsWithFragmentSuspenseQuery >; +export type HeroDetailsWithFragmentBackgroundQueryHookResult = ReturnType< + typeof useHeroDetailsWithFragmentBackgroundQuery +>; +export type HeroDetailsWithFragmentLoadableQueryHookResult = ReturnType< + typeof useHeroDetailsWithFragmentLoadableQuery +>; export type HeroDetailsWithFragmentQueryResult = Apollo.QueryResult< HeroDetailsWithFragmentQuery, HeroDetailsWithFragmentQueryVariables @@ -634,9 +724,24 @@ export function useHeroNameSuspenseQuery( const options = { ...defaultOptions, ...baseOptions }; return Apollo.useSuspenseQuery(HeroNameDocument, options); } +export function useHeroNameBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery( + HeroNameDocument, + options, + ); +} +export function useHeroNameLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery(HeroNameDocument, options); +} export type HeroNameQueryHookResult = ReturnType; export type HeroNameLazyQueryHookResult = ReturnType; export type HeroNameSuspenseQueryHookResult = ReturnType; +export type HeroNameBackgroundQueryHookResult = ReturnType; +export type HeroNameLoadableQueryHookResult = ReturnType; export type HeroNameQueryResult = Apollo.QueryResult; export function refetchHeroNameQuery(variables?: HeroNameQueryVariables) { return { query: HeroNameDocument, variables: variables }; @@ -703,6 +808,27 @@ export function useHeroNameConditionalInclusionSuspenseQuery( HeroNameConditionalInclusionQueryVariables >(HeroNameConditionalInclusionDocument, options); } +export function useHeroNameConditionalInclusionBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + HeroNameConditionalInclusionQuery, + HeroNameConditionalInclusionQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery< + HeroNameConditionalInclusionQuery, + HeroNameConditionalInclusionQueryVariables + >(HeroNameConditionalInclusionDocument, options); +} +export function useHeroNameConditionalInclusionLoadableQuery( + baseOptions?: Apollo.LoadableQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery< + HeroNameConditionalInclusionQuery, + HeroNameConditionalInclusionQueryVariables + >(HeroNameConditionalInclusionDocument, options); +} export type HeroNameConditionalInclusionQueryHookResult = ReturnType< typeof useHeroNameConditionalInclusionQuery >; @@ -712,6 +838,12 @@ export type HeroNameConditionalInclusionLazyQueryHookResult = ReturnType< export type HeroNameConditionalInclusionSuspenseQueryHookResult = ReturnType< typeof useHeroNameConditionalInclusionSuspenseQuery >; +export type HeroNameConditionalInclusionBackgroundQueryHookResult = ReturnType< + typeof useHeroNameConditionalInclusionBackgroundQuery +>; +export type HeroNameConditionalInclusionLoadableQueryHookResult = ReturnType< + typeof useHeroNameConditionalInclusionLoadableQuery +>; export type HeroNameConditionalInclusionQueryResult = Apollo.QueryResult< HeroNameConditionalInclusionQuery, HeroNameConditionalInclusionQueryVariables @@ -783,6 +915,27 @@ export function useHeroNameConditionalExclusionSuspenseQuery( HeroNameConditionalExclusionQueryVariables >(HeroNameConditionalExclusionDocument, options); } +export function useHeroNameConditionalExclusionBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + HeroNameConditionalExclusionQuery, + HeroNameConditionalExclusionQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery< + HeroNameConditionalExclusionQuery, + HeroNameConditionalExclusionQueryVariables + >(HeroNameConditionalExclusionDocument, options); +} +export function useHeroNameConditionalExclusionLoadableQuery( + baseOptions?: Apollo.LoadableQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery< + HeroNameConditionalExclusionQuery, + HeroNameConditionalExclusionQueryVariables + >(HeroNameConditionalExclusionDocument, options); +} export type HeroNameConditionalExclusionQueryHookResult = ReturnType< typeof useHeroNameConditionalExclusionQuery >; @@ -792,6 +945,12 @@ export type HeroNameConditionalExclusionLazyQueryHookResult = ReturnType< export type HeroNameConditionalExclusionSuspenseQueryHookResult = ReturnType< typeof useHeroNameConditionalExclusionSuspenseQuery >; +export type HeroNameConditionalExclusionBackgroundQueryHookResult = ReturnType< + typeof useHeroNameConditionalExclusionBackgroundQuery +>; +export type HeroNameConditionalExclusionLoadableQueryHookResult = ReturnType< + typeof useHeroNameConditionalExclusionLoadableQuery +>; export type HeroNameConditionalExclusionQueryResult = Apollo.QueryResult< HeroNameConditionalExclusionQuery, HeroNameConditionalExclusionQueryVariables @@ -877,6 +1036,27 @@ export function useHeroParentTypeDependentFieldSuspenseQuery( HeroParentTypeDependentFieldQueryVariables >(HeroParentTypeDependentFieldDocument, options); } +export function useHeroParentTypeDependentFieldBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + HeroParentTypeDependentFieldQuery, + HeroParentTypeDependentFieldQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery< + HeroParentTypeDependentFieldQuery, + HeroParentTypeDependentFieldQueryVariables + >(HeroParentTypeDependentFieldDocument, options); +} +export function useHeroParentTypeDependentFieldLoadableQuery( + baseOptions?: Apollo.LoadableQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery< + HeroParentTypeDependentFieldQuery, + HeroParentTypeDependentFieldQueryVariables + >(HeroParentTypeDependentFieldDocument, options); +} export type HeroParentTypeDependentFieldQueryHookResult = ReturnType< typeof useHeroParentTypeDependentFieldQuery >; @@ -886,6 +1066,12 @@ export type HeroParentTypeDependentFieldLazyQueryHookResult = ReturnType< export type HeroParentTypeDependentFieldSuspenseQueryHookResult = ReturnType< typeof useHeroParentTypeDependentFieldSuspenseQuery >; +export type HeroParentTypeDependentFieldBackgroundQueryHookResult = ReturnType< + typeof useHeroParentTypeDependentFieldBackgroundQuery +>; +export type HeroParentTypeDependentFieldLoadableQueryHookResult = ReturnType< + typeof useHeroParentTypeDependentFieldLoadableQuery +>; export type HeroParentTypeDependentFieldQueryResult = Apollo.QueryResult< HeroParentTypeDependentFieldQuery, HeroParentTypeDependentFieldQueryVariables @@ -960,6 +1146,27 @@ export function useHeroTypeDependentAliasedFieldSuspenseQuery( HeroTypeDependentAliasedFieldQueryVariables >(HeroTypeDependentAliasedFieldDocument, options); } +export function useHeroTypeDependentAliasedFieldBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + HeroTypeDependentAliasedFieldQuery, + HeroTypeDependentAliasedFieldQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery< + HeroTypeDependentAliasedFieldQuery, + HeroTypeDependentAliasedFieldQueryVariables + >(HeroTypeDependentAliasedFieldDocument, options); +} +export function useHeroTypeDependentAliasedFieldLoadableQuery( + baseOptions?: Apollo.LoadableQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery< + HeroTypeDependentAliasedFieldQuery, + HeroTypeDependentAliasedFieldQueryVariables + >(HeroTypeDependentAliasedFieldDocument, options); +} export type HeroTypeDependentAliasedFieldQueryHookResult = ReturnType< typeof useHeroTypeDependentAliasedFieldQuery >; @@ -969,6 +1176,12 @@ export type HeroTypeDependentAliasedFieldLazyQueryHookResult = ReturnType< export type HeroTypeDependentAliasedFieldSuspenseQueryHookResult = ReturnType< typeof useHeroTypeDependentAliasedFieldSuspenseQuery >; +export type HeroTypeDependentAliasedFieldBackgroundQueryHookResult = ReturnType< + typeof useHeroTypeDependentAliasedFieldBackgroundQuery +>; +export type HeroTypeDependentAliasedFieldLoadableQueryHookResult = ReturnType< + typeof useHeroTypeDependentAliasedFieldLoadableQuery +>; export type HeroTypeDependentAliasedFieldQueryResult = Apollo.QueryResult< HeroTypeDependentAliasedFieldQuery, HeroTypeDependentAliasedFieldQueryVariables @@ -1038,6 +1251,25 @@ export function useHumanWithNullHeightSuspenseQuery( options, ); } +export function useHumanWithNullHeightBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions< + HumanWithNullHeightQuery, + HumanWithNullHeightQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery( + HumanWithNullHeightDocument, + options, + ); +} +export function useHumanWithNullHeightLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery( + HumanWithNullHeightDocument, + options, + ); +} export type HumanWithNullHeightQueryHookResult = ReturnType; export type HumanWithNullHeightLazyQueryHookResult = ReturnType< typeof useHumanWithNullHeightLazyQuery @@ -1045,6 +1277,12 @@ export type HumanWithNullHeightLazyQueryHookResult = ReturnType< export type HumanWithNullHeightSuspenseQueryHookResult = ReturnType< typeof useHumanWithNullHeightSuspenseQuery >; +export type HumanWithNullHeightBackgroundQueryHookResult = ReturnType< + typeof useHumanWithNullHeightBackgroundQuery +>; +export type HumanWithNullHeightLoadableQueryHookResult = ReturnType< + typeof useHumanWithNullHeightLoadableQuery +>; export type HumanWithNullHeightQueryResult = Apollo.QueryResult< HumanWithNullHeightQuery, HumanWithNullHeightQueryVariables @@ -1099,9 +1337,27 @@ export function useTwoHeroesSuspenseQuery( options, ); } +export function useTwoHeroesBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery( + TwoHeroesDocument, + options, + ); +} +export function useTwoHeroesLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery( + TwoHeroesDocument, + options, + ); +} export type TwoHeroesQueryHookResult = ReturnType; export type TwoHeroesLazyQueryHookResult = ReturnType; export type TwoHeroesSuspenseQueryHookResult = ReturnType; +export type TwoHeroesBackgroundQueryHookResult = ReturnType; +export type TwoHeroesLoadableQueryHookResult = ReturnType; export type TwoHeroesQueryResult = Apollo.QueryResult; export function refetchTwoHeroesQuery(variables?: TwoHeroesQueryVariables) { return { query: TwoHeroesDocument, variables: variables }; diff --git a/dev-test/test-message/types.tsx b/dev-test/test-message/types.tsx index f665857ba..0fc177731 100644 --- a/dev-test/test-message/types.tsx +++ b/dev-test/test-message/types.tsx @@ -149,9 +149,27 @@ export function useGetMessagesSuspenseQuery( options, ); } +export function useGetMessagesBackgroundQuery( + baseOptions?: Apollo.BackgroundQueryHookOptions, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useBackgroundQuery( + Operations.GetMessages, + options, + ); +} +export function useGetMessagesLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLoadableQuery( + Operations.GetMessages, + options, + ); +} export type GetMessagesQueryHookResult = ReturnType; export type GetMessagesLazyQueryHookResult = ReturnType; export type GetMessagesSuspenseQueryHookResult = ReturnType; +export type GetMessagesBackgroundQueryHookResult = ReturnType; +export type GetMessagesLoadableQueryHookResult = ReturnType; export type GetMessagesQueryResult = Apollo.QueryResult< GetMessagesQuery, GetMessagesQueryVariables diff --git a/package.json b/package.json index 141f9f1a0..59d91df1b 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "packages/presets/*" ], "packageManager": "yarn@1.22.22", + "packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610", "scripts": { "build": "bob build", "ci:lint": "eslint --ext .ts . --output-file eslint_report.json --format json", diff --git a/packages/plugins/typescript/react-apollo/src/visitor.ts b/packages/plugins/typescript/react-apollo/src/visitor.ts index a9367e9c0..d80010270 100644 --- a/packages/plugins/typescript/react-apollo/src/visitor.ts +++ b/packages/plugins/typescript/react-apollo/src/visitor.ts @@ -434,7 +434,6 @@ export class ReactApolloVisitor extends ClientSideBaseVisitor< suffix: pascalCase('SuspenseQuery'), useTypesPrefix: false, }) + this.config.hooksSuffix; - hookFns.push( `export function use${suspenseOperationName}(baseOptions?: ${this.getApolloReactHooksIdentifier()}.SuspenseQueryHookOptions<${operationResultType}, ${operationVariablesTypes}>) { const options = {...defaultOptions, ...baseOptions} @@ -447,6 +446,42 @@ export class ReactApolloVisitor extends ClientSideBaseVisitor< hookResults.push( `export type ${suspenseOperationName}HookResult = ReturnType;`, ); + + const backgroundOperationName: string = + this.convertName(nodeName, { + suffix: pascalCase('BackgroundQuery'), + useTypesPrefix: false, + }) + this.config.hooksSuffix; + hookFns.push( + `export function use${backgroundOperationName}(baseOptions?: ${this.getApolloReactHooksIdentifier()}.BackgroundQueryHookOptions<${operationResultType}, ${operationVariablesTypes}>) { + const options = {...defaultOptions, ...baseOptions} + return ${this.getApolloReactHooksIdentifier()}.useBackgroundQuery<${operationResultType}, ${operationVariablesTypes}>(${this.getDocumentNodeVariable( + node, + documentVariableName, + )}, options); + }`, + ); + hookResults.push( + `export type ${backgroundOperationName}HookResult = ReturnType;`, + ); + + const loadableOperationName: string = + this.convertName(nodeName, { + suffix: pascalCase('LoadableQuery'), + useTypesPrefix: false, + }) + this.config.hooksSuffix; + hookFns.push( + `export function use${loadableOperationName}(baseOptions?: ${this.getApolloReactHooksIdentifier()}.LoadableQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return ${this.getApolloReactHooksIdentifier()}.useLoadableQuery<${operationResultType}, ${operationVariablesTypes}>(${this.getDocumentNodeVariable( + node, + documentVariableName, + )}, options); + }`, + ); + hookResults.push( + `export type ${loadableOperationName}HookResult = ReturnType;`, + ); } return [...hookFns, ...hookResults].join('\n'); diff --git a/packages/plugins/typescript/react-apollo/tests/__snapshots__/react-apollo.spec.ts.snap b/packages/plugins/typescript/react-apollo/tests/__snapshots__/react-apollo.spec.ts.snap index a1d3de1ce..b9a4a6c4c 100644 --- a/packages/plugins/typescript/react-apollo/tests/__snapshots__/react-apollo.spec.ts.snap +++ b/packages/plugins/typescript/react-apollo/tests/__snapshots__/react-apollo.spec.ts.snap @@ -194,9 +194,19 @@ export function useGet_SomethingSuspenseQuery(baseOptions?: Apollo.SuspenseQuery const options = {...defaultOptions, ...baseOptions} return Apollo.useSuspenseQuery(Get_SomethingDocument, options); } +export function useGet_SomethingBackgroundQuery(baseOptions?: Apollo.BackgroundQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useBackgroundQuery(Get_SomethingDocument, options); + } +export function useGet_SomethingLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLoadableQuery(Get_SomethingDocument, options); + } export type Get_SomethingQueryHookResult = ReturnType; export type Get_SomethingLazyQueryHookResult = ReturnType; export type Get_SomethingSuspenseQueryHookResult = ReturnType; +export type Get_SomethingBackgroundQueryHookResult = ReturnType; +export type Get_SomethingLoadableQueryHookResult = ReturnType; export type Get_SomethingQueryResult = Apollo.QueryResult;" `; @@ -394,9 +404,19 @@ export function useGet_SomethingSuspenseQuery(baseOptions?: Apollo.SuspenseQuery const options = {...defaultOptions, ...baseOptions} return Apollo.useSuspenseQuery(Get_SomethingDocument, options); } +export function useGet_SomethingBackgroundQuery(baseOptions?: Apollo.BackgroundQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useBackgroundQuery(Get_SomethingDocument, options); + } +export function useGet_SomethingLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLoadableQuery(Get_SomethingDocument, options); + } export type Get_SomethingQueryHookResult = ReturnType; export type Get_SomethingLazyQueryHookResult = ReturnType; export type Get_SomethingSuspenseQueryHookResult = ReturnType; +export type Get_SomethingBackgroundQueryHookResult = ReturnType; +export type Get_SomethingLoadableQueryHookResult = ReturnType; export type Get_SomethingQueryResult = Apollo.QueryResult;" `; @@ -594,9 +614,19 @@ export function useGetSomethingSuspenseQuery(baseOptions?: Apollo.SuspenseQueryH const options = {...defaultOptions, ...baseOptions} return Apollo.useSuspenseQuery(GetSomethingDocument, options); } +export function useGetSomethingBackgroundQuery(baseOptions?: Apollo.BackgroundQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useBackgroundQuery(GetSomethingDocument, options); + } +export function useGetSomethingLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLoadableQuery(GetSomethingDocument, options); + } export type GetSomethingQueryHookResult = ReturnType; export type GetSomethingLazyQueryHookResult = ReturnType; export type GetSomethingSuspenseQueryHookResult = ReturnType; +export type GetSomethingBackgroundQueryHookResult = ReturnType; +export type GetSomethingLoadableQueryHookResult = ReturnType; export type GetSomethingQueryResult = Apollo.QueryResult;" `; @@ -794,9 +824,19 @@ export function useGetSomethingSuspenseQuery(baseOptions?: Apollo.SuspenseQueryH const options = {...defaultOptions, ...baseOptions} return Apollo.useSuspenseQuery(GetSomethingDocument, options); } +export function useGetSomethingBackgroundQuery(baseOptions?: Apollo.BackgroundQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useBackgroundQuery(GetSomethingDocument, options); + } +export function useGetSomethingLoadableQuery(baseOptions?: Apollo.LoadableQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLoadableQuery(GetSomethingDocument, options); + } export type GetSomethingQueryHookResult = ReturnType; export type GetSomethingLazyQueryHookResult = ReturnType; export type GetSomethingSuspenseQueryHookResult = ReturnType; +export type GetSomethingBackgroundQueryHookResult = ReturnType; +export type GetSomethingLoadableQueryHookResult = ReturnType; export type GetSomethingQueryResult = Apollo.QueryResult;" `;