How to use the @apollo/client.useLazyQuery function in @apollo/client

To help you get started, we’ve selected a few @apollo/client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dotansimha / graphql-code-generator / dev-test / test-message / types.tsx View on Github external
export function useGetMessagesLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) {
  return ApolloReactHooks.useLazyQuery(Operations.GetMessages, baseOptions);
}
export type GetMessagesQueryHookResult = ReturnType;
github ahrnee / graphql-codegen-hasura / demo / src / autogen / hasura / react.ts View on Github external
export function useFetchVehicleGraphLocationOnlyObjectsLazyQuery( options?: Omit, 'query'> ) {
        const lazyQuery = useLazyQuery(FetchVehicleGraphLocationOnlyDocument, options );
      
        const pickObjects = (query: FetchVehicleGraphLocationOnlyQuery | null | undefined) => { return ( query && query.vehicle ); };
        
        const wrappedLazyQuery = ( options?: QueryLazyOptions ) => {
          return lazyQuery[0]();
        };
    
        return [wrappedLazyQuery, { ...lazyQuery[1], objects: pickObjects(lazyQuery[1].data) }] as [typeof wrappedLazyQuery, typeof lazyQuery[1] & { objects: ReturnType }];
      }
github ahrnee / graphql-codegen-hasura / demo / src / autogen / hasura / react.ts View on Github external
export function useFetchVehicleGraphObjectsLazyQuery( options?: Omit, 'query'> ) {
        const lazyQuery = useLazyQuery(FetchVehicleGraphDocument, options );
      
        const pickObjects = (query: FetchVehicleGraphQuery | null | undefined) => { return ( query && query.vehicle ); };
        
        const wrappedLazyQuery = ( options?: QueryLazyOptions ) => {
          return lazyQuery[0]();
        };
    
        return [wrappedLazyQuery, { ...lazyQuery[1], objects: pickObjects(lazyQuery[1].data) }] as [typeof wrappedLazyQuery, typeof lazyQuery[1] & { objects: ReturnType }];
      }
github ahrnee / graphql-codegen-hasura / demo / src / autogen / hasura / react.ts View on Github external
export function useFetchVehicleGraphByIdLazyQuery(options?: Omit, 'query' | 'variables'>) {
        const lazyQuery = useLazyQuery(FetchVehicleGraphByIdDocument, options );
        
        const pickVehicleGraph = (query: FetchVehicleGraphByIdQuery | null | undefined) => { return ( query && query.vehicle_by_pk ); };
        
        const wrappedLazyQuery = ({ vehicleId, options }: { vehicleId:string, options?: Omit, 'variables'> }) => {
          return lazyQuery[0]({ variables: { vehicleId }, ...options });
        };   

        return [wrappedLazyQuery, { ...lazyQuery[1], vehicleGraph: pickVehicleGraph(lazyQuery[1].data) }] as [typeof wrappedLazyQuery, typeof lazyQuery[1] & { vehicleGraph: ReturnType }];
      }
github seashell / drago / ui / src / modals / connect-peer / index.js View on Github external
variables: { id: nodeId },
  })

  const handleGetNetworksQueryData = (data) => {
    setNetworks(data.result)
  }

  const handleGetPeersQueryData = (data) => {
    setPeers(data.result)
  }

  const getNetworksQuery = useQuery(GET_NETWORKS, {
    onCompleted: handleGetNetworksQueryData,
  })

  const [getPeers, getPeersQuery] = useLazyQuery(GET_PEERS, {
    onCompleted: handleGetPeersQueryData,
  })

  useEffect(() => {
    window.scrollTo(0, 0)
  }, [])

  useEffect(() => {
    if (isOpen) {
      setPeers([])
      setNetworks([])
      setSelectedPeer(undefined)
      setSelectedNetwork(undefined)
      if (getPeersQuery.called) {
        getNetworksQuery.refetch({}).then((res) => handleGetNetworksQueryData(res.data))
      }
github minskylab / supersense / observer / generated / graphql.tsx View on Github external
export function useSharedBoardLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) {
          return Apollo.useLazyQuery(SharedBoardDocument, baseOptions);
        }
export type SharedBoardQueryHookResult = ReturnType;
github ahrnee / graphql-codegen-hasura / demo / src / autogen / hasura / react.ts View on Github external
export function useFetchVehicleGraphLocationOnlyByIdLazyQuery(options?: Omit, 'query' | 'variables'>) {
        const lazyQuery = useLazyQuery(FetchVehicleGraphLocationOnlyByIdDocument, options );
        
        const pickVehicleGraphLocationOnly = (query: FetchVehicleGraphLocationOnlyByIdQuery | null | undefined) => { return ( query && query.vehicle_by_pk ); };
        
        const wrappedLazyQuery = ({ vehicleId, options }: { vehicleId:string, options?: Omit, 'variables'> }) => {
          return lazyQuery[0]({ variables: { vehicleId }, ...options });
        };   

        return [wrappedLazyQuery, { ...lazyQuery[1], vehicleGraphLocationOnly: pickVehicleGraphLocationOnly(lazyQuery[1].data) }] as [typeof wrappedLazyQuery, typeof lazyQuery[1] & { vehicleGraphLocationOnly: ReturnType }];
      }
github ahrnee / graphql-codegen-hasura / demo / src / autogen / hasura / react.ts View on Github external
export function useFetchDogModelByIdLazyQuery(options?: Omit, 'query' | 'variables'>) {
        const lazyQuery = useLazyQuery(FetchDogModelByIdDocument, options );
        
        const pickDogModel = (query: FetchDogModelByIdQuery | null | undefined) => { return ( query && query.dogs_by_pk ); };
        
        const wrappedLazyQuery = ({ dogsId, options }: { dogsId:string, options?: Omit, 'variables'> }) => {
          return lazyQuery[0]({ variables: { dogsId }, ...options });
        };   

        return [wrappedLazyQuery, { ...lazyQuery[1], dogModel: pickDogModel(lazyQuery[1].data) }] as [typeof wrappedLazyQuery, typeof lazyQuery[1] & { dogModel: ReturnType }];
      }
github ahrnee / graphql-codegen-hasura / demo / src / autogen / hasura / react.ts View on Github external
export function useFetchDogModelObjectsLazyQuery( options?: Omit, 'query'> ) {
        const lazyQuery = useLazyQuery(FetchDogModelDocument, options );
      
        const pickObjects = (query: FetchDogModelQuery | null | undefined) => { return ( query && query.dogs ); };
        
        const wrappedLazyQuery = ( options?: QueryLazyOptions ) => {
          return lazyQuery[0]();
        };
    
        return [wrappedLazyQuery, { ...lazyQuery[1], objects: pickObjects(lazyQuery[1].data) }] as [typeof wrappedLazyQuery, typeof lazyQuery[1] & { objects: ReturnType }];
      }