Urql lazy query. Technically, Suspense usage other than React. Urql lazy query

 
Technically, Suspense usage other than ReactUrql lazy query  It is used to resolve records or links on any given entity and accepts three arguments: entity: This is the entity on which we'd like to access a field

svelteYou can find a code example of subscriptions via fetch in an example in the urql repository. 1 queries are updated even with requestPolicy: "network-only". Parts of urql that automatically start, like the useQuery hook, have a concept of a pause option. The query now accepts arguments that you’ll use to implement pagination and ordering. 1. gregorybellencontre. This workspaceMembers query is a paginated query (using graph cache and the simplePagination helper) - it also supports a "search" variable that can be any string. Another use case for lazy queries: Apollo Client depends on a jwt token which is passed in headers so gql server can do row-level authorization. A function callback must be passed. Next. The only thing that comes to my mind is to have that query for a second time there with suspense disabled and that fetchPolicy to keep cache up-to-date. useSubscription takes an object, like useQuery this object expects a property of. Learn how to write an exchange. UPDATE: I investigated how new records are being cached, and I found that: On the first insert (new1), it adds an extra record to the current (first used) query (default query:. To help you get started, we’ve selected a few urql examples, based on popular ways it is used in public projects. I have two components in the tree that each call useQuery with distinct queries against completely different parts of the schema. Installation & Setup. Our application will connect to a database, and we will use the Quarkus Panache module as the ORM provider. user returns a User, which is then updated by a mutation on Mutation. The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow. url: '}); The client has more options, but the url is the only mandatory one. URQL, SWR, react-query, nor even RTK Query are meant to be wholesale replacements for Redux which is meant for global state. example. We now have two ways to leverage @urql/next, one being part of a Server component or being part of the general app/ folder. The GraphQL specification allows clients to introspect the schema with a special set of types and fields that every schema must include. Suspense has been in the making for. We need a major version up for the new API, thus it’s going to be v2 API. # or. The type information of our entities isn't lost however. 0. . I want direct. Assume this is your query; const [result] = useQuery({ query: <QUERY-NAME>, variables: { <VARIABLES>, }, }) By examining following property path: result. Part 2. In theory, you could refetch every active query after a client-side update, but you can save time and network bandwidth by. js based library for creating sleek presentations using JSX syntax that gives you the ability to live demo your code. Urql and Apollo both concentrate on GraphQL, React Query focuses on data. In this section, we will see the standard provided by both Apollo Client or urql on how to cache GraphQL queries. js 13 there have been some changes to the Router. import { CombinedError, useClient, TypedDocumentNode, OperationResult } from 'urql'. Strategies for GraphQL caching. Next, we’ll style our app in the index. useFragment never triggers network. E is indeed an object-type. md at main · urql-graphql/urqluseQuery Parameters . As shown above, you can pass options to the query function just like you pass them to useLazyQuery itself. This question probably isn't super urql-specific, but maybe there's some sort of graphql-y answer to it. expert led courses for front-end web developers and teams that want to level up through straightforward and concise lessons on the most useful tools available. It handles caching, revalidation, focus tracking, refetching on intervals, and more. getPhotos(this. Runpkg The online package explorer. To get started, we first need to export the HABITS_QUERY from App. This means that the effect hook will return early and set the query result to "lazy". To review, open the file in an editor that reveals hidden Unicode characters. Once that’s finished doing it’s thing I can change into the newly created project ( cd) directory and install the dependencies along with the dependencies I’ll need for URQL: # change into newly created project directory cd sveltekit-with-urql # install dependencies npm i # install dependencies for URQL npm i -D @urql/svelte graphql. 1 componentDidMount() { 2 this. Apollo Client. You signed out in another tab or window. 0. invalidateQueries(['data']) Some other notable libraries that also solve the problems are SWR, URQL and Apollo Client. store the URQL client from the class object in state. Whenever urql finds an operation hash coming through that matches a hash in the cacheExchange, it will return that value based on the requestPolicy. In Next. This hook returns an always-up-to-date view of whatever data the cache currently contains for a given fragment. As the GraphQL API walks our query documents it may read from a relational database and entities and scalar values are copied into a JSON document that matches our query document. Therefore, it should be enough to check if result. useQuery ("fetchData", fetchData, { onSuccess: (data) => { console. You don't need to set the results of a useQuery as React state after they have resolved, you can just use data directly as you would any other variable (e. /query. Urql seems to sit somewhere in between GraphQL Request and Apollo Client, having more features and. I wonder what is the use case for this?The Github GraphQL v4 API has so-called Schema Previews where you can use new schema features - but it requires a custom Accept header. urql, the graphql-client that grows with you (3 Part Series) 1 How to urql, basics 2 How to urql, authentication & multiple users 3 How to urql, normalized caching. React-Query. Improve this. gql is a utility that allows a DocumentNode to be created directly, and others to be interpolated. Unlike React Query, RTK Query draws inspiration from other tools, such as React Query, Urql, and SWR, that have pioneered approaches to data retrieval. But first, let's set up our editor (VSCode) so that it can autocomplete the code when editing or creating queries. React query is in itself a global state manager. In other words easy fetch on page param change; not using +page. First install @urql/exchange-retry alongside urql: yarn add @urql/exchange-retry. URQL looks a bit similar to. Its usage is extremely similar in that it accepts options, which may contain query and. urql aims to be both easy to use and extensible through built-in caching mechanisms with sensible defaults. The client gets a special fetch function from the event which has a few nice properties, like preventing a second network request on the client side if that. I'm new in graphql and urql, for this case I should add redux and dispatch actions with new fetched data from urql or is there any trick to connect other components to cached urql data. The authExchange is an asynchronous exchange, so it must be placed in front of all fetchExchange s but after. ) as the value of that variable is managed by Apollo via its own internal React state. export that instantiated class (the object, not the class) create event listeners on the class to enable other contexts to register callbacks when the URQL client is regenerated. The function that the query will use to request data. GraphQL combined. urql is a fairly full-featured GraphQL library for React that makes interacting with GraphQL APIs a lot simpler. useFragmentSince 3. Since the urql and @urql/preact. To review, open the file in an editor that reveals hidden Unicode characters. Technically, Suspense usage other than React. Reload to refresh your session. By the way, for usage questions like these we also have the "Discussions" feature on GitHub which gives us more space to discuss questions. A highly customizable and versatile GraphQL client for React. You can do so by using the where clause and comparison operators. ts, it makes request proxied through server. I don't know whether or not there is any, nor do I know how to use urql. If you pass a particular option to both, the value you pass to the query function takes precedence. Adding this is at odds with our hackability / composability ideals, which dictate that all. Usage with @tanstack/react-query. urql is a more dynamic approach on GraphQL clients and a newer project compared to Relay and Apollo. updateUser. Providing the Client. In this chapter we'll explain the basics of urql and how to get started with using it without any prior knowledge. Looking at the useQuery API however, you'd probably need to set enabled to false, and then use refetch to manually query when the button is pressed. You could write them by hand or. Features. Stack Overflow Public questions & answers; Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Talent Build your employer brand ; Advertising Reach developers & technologists worldwide; Labs The future of collective knowledge sharing; About the companyApollo has a lot of API that urql does not. Urql provides a useSubscription hook for us to subscribe to a GraphQL subscription. React/Preact covers how to work with the bindings for React/Preact. dedupExchange — is responsible for deduplicating operations. 1 Introduction to Urqls useQuery React Hook 2 Make a GraphQL Query Dynamic with Variables and Urqls useQuery Hook 3 Write a GraphQL Mutation using React Hooks with Urql 4 Write a GraphQL Subscription with React Hooks using Urql 5 Understand Urql's Exchanges and Request Policies. ts. { query { post(id: 1) { title author { name } } } } author field without nested query: { query { post(id: 1) { title author } } } As you can see, the response to field author is, in the first case, the object {"name": "leo"}, and in the second case, it is the string "1". The @urql/core package contains urql's Client, some common utilities, and some default Exchanges. queryFn: (context: QueryFunctionContext) => Promise<TData> Required, but only if no default query function has been defined See Default Query Function for more information. - Relay docs. ) Therefore, I can't use <Query /> or useQuery, etc. There are 130 other projects in the npm registry using urql. The React bindings for urql call methods on the Client that return a “stream” of results. @babichjacob still get empty data in SSR using createClient, can you plz share link or same documentation about this topic, cuz i won't to broth u, tnx bro. Then paste the following code into it: You now have two functions that you can use in the upcoming steps to set up authentication: the getToken funtion returns the token or null if the user is not logged in yet. Apollo provides tools for every developer that interacts with GraphQL—whether you're building your first API, querying an existing one, or moving your. Thus, there are an indeterminate number of variable combinations - ideas re how should we go about updating the cache to delete the removed member?You should now have enough information to set up an Urql client that handles multiple GraphQL API endpoints. events. Start using urql in your project by running `npm i urql`. URQL is a lightweight, extensible GraphQL client for React. Features. urql was installed in two of the workspace packages. There are plans in the App Router Roadmap for event intercepting and hash handeling. This <Provider> component holds the client that is used to manage data, requests, the cache, and other things such that every component below it has an access to the client. Learn more about TeamsOptimistic updates are meant to reflect an early answer from the server, using to indicate something is updating isn't really its use case. js/React app. Normalized caching is cool, but I’ll take the simplicity of RQ any day. namingConvention. SWC. 2 (5. query. Feature request: allow to return promise in fetchOptions function #234 (Same Request) Extending fetchOptions makes sense and helps simplicity, i. When this hook is executed for the first time, lazy will be set to true and invalidate will be set to 0. Teams. Query. Hello, Apollo has the very useful useLazyQuery which allows to trigger the query independently of the component rendering. This is usually done with a timing threshold. /* React-specific entry point that automatically generates. 📦 One package to get a working GraphQL client in React; ⚙️ Fully customisable behaviour via "exchanges"; 🗂 Logical but simple default behaviour and document caching; ⚛️ Minimal React components and hooks; 🌱 Normalized caching via @urql/exchange-graphcache; urql is a GraphQL client that exposes a set of React components and. When you couple these updates together in certain unpredictable ways outside of the "client area" in your UI code then you'll introduce a lot of edge cases. They have an example which matches this use case (clicking a button fires the query). Incremental loading: fetchMore You can use the fetchMore function to update. 4kb package. documentNodeImport. 3 Final Beta: custom query functions, lazy queries, and more! 3 projects | /r. 7 SWR's Immutable Mode - SWR ships with an "immutable" mode that does allow you to only fetch a query once for the life of the cache, but it still does not have the concept of stale-time or conditional auto-revalidation. : query: An object. I would like to confirm that the test I am implementing works with the following configuration. These low-level methods are called executeQuery, executeMutation, and executeSubscription. The component prop is the component that will be rendered when the route is matched. The typescript-urql-plugin generates React hooks while, the client-preset generated typed GraphQL documents that can be used with URQL's native useQuery() and useMutation(). By default, urql uses a concept called Document Caching. type: NamingConvention default: change-case-all#pascalCase. legacyMode. graph-client is perfectly integrated with other GraphQL clients such as Apollo client, URQL, or React Query; you will find examples in the official repository. variables: (default: null) Variables object. If false, it will work with @tanstack/react-query, default value is true. Install the dependencies. resolve() method. Part 1 — GraphQL Server. URQL. You can follow along by using this template. legacyMode. Read more about. npm install --save @urql/next urql graphql. tsx which defeats the purpose and does not allow to select pages to ssr or not. This table provides a quick overview of the three GraphQL clients, along with some of their noteworthy features. 📣 Please note these bindings were previously maintained by Formidable, but have since been taken over by the ReScript Brazil community. Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client. jsThis JSON file will be used in client-side routing through next/link or next/router. . Root Types Root types are the entry points for queries, mutations and subscriptions. Let’s jump in! 🚀. - GitHub - enisdenjo/graphql-ws: Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client. In @urql/vue there are two different ways to achieve this. Apollo GraphOS is the developer platform for building a supergraph: a unified network of your organization's data and services, all composed into a single distributed GraphQL API. Proposed Solution. It is designed to simplify common cases for loading data in a web application, eliminating the need to hand-write data fetching & caching logic yourself. Getting started. The API includes a few important utilities, including the fetchMore function and the @connection directive. In the route component itself, you can useLoaderData () to get. Published Fri Oct 15 2021 - 2. Whenever we decide to send our GraphQL requests to a GraphQL API we start by using urql's. Some of the functionality it has to make our lives easier include: Reloading a query when a query variable changes; Reloading a query after a mutation that touches the same data as the query; We want to keep these features, even when using urql when doing SSR. js trick fixed this for urql 👍 I guess it would make sense to make this part of the default metro. Secondly we set the exchanges. Is there any recommended way to run one query after another in urql, passing the results of the first into the second? The text was updated successfully, but these errors were encountered: All reactions. The template above builds on the example. env . config. Lazy query. Reproduction. An Advanced GraphQL with Quarkus. GET_CHAPTERS is a typical GraphQL query that uses the gql method from Apollo. There is a point, storing some data (state) on the query field of the URL is necessary some times, But I don't like to handle this directly, I think syncing store with the URL will be a good idea. If you want to follow along you can use this template. Part 1. svelte') in my code. Apollo is production-ready and has handy features like caching, optimistic UI, subscription support and many more. 7 SWR's Immutable Mode - SWR ships with an "immutable" mode that does allow you to only fetch a query once for the life of the cache, but it still does not have the concept of stale-time or conditional auto-revalidation. js or Gatsby. For example ^ this. I found out that the documentation provides a function for that. this API is already there and we're only limiting this to encourage a more solid exchange to be written. 2 Answers. You'll. It uses its own state for search term value, which is very convenient if you want to add extra "filters" for debounced value (for example, start query only when search term's length is greater than some value). Since the mutation also queries the User, the updated username will automatically be applied by Graphcache. e. in the root component: We’re going to make a real-time chat application using GraphQL subscriptions. . link updates and/or creates a link and is useful in most cases where it feels excessive to write a query or fragment just to update the cache. GraphQL is a powerful query language for APIs and a runtime for fulfilling those queries with your existing data. type: boolean default: true. This guide covers how to install and setup urql and the Client, as well as query and mutate data, with React and Preact. RTK Query is an optional addon included in the Redux Toolkit package, and its functionality is built on top of the other APIs in Redux Toolkit. Apollo is flexible and easygoing, Relay is opinionated and structured, and URQL is lightweight and extensible. URQL URQL is a lighter library than the apollo client but allows you to query the API all the same. kitten commented Jun 8, 2019. For this walkthrough we'll. However, I'm struggling to find a good way to query multiple collections for use in a single component. First, we create our client. The query isn't really optional just the execution of the query. Edit: 2 Years after the question was posted, the question tags were edited to add "react-query" which wasn't in the original question. This option is used to prevent the hook from. The client is the central orchestrator of rescript-urql, and is responsible for executing queries, mutations, and subscriptions passed to useQuery, useMutation, and useSubscription. 📦 One package to get a working GraphQL client in React, Preact, Vue, and Svelte; ⚙️ Fully customisable behaviour via "exchanges"; 🗂 Logical but simple default behaviour and document caching; 🌱 Normalized caching via @urql/exchange-graphcache; 🔬 Easy debugging with the urql devtools browser extensions; urql is a GraphQL client that. It is a few years old, so I am scrambling to modify the code to work with updated packages, specifically here urql-graphcache. Describe the bug Using the executeQuery function returned by the useQuery function with new variables doesn't actually send the new variables in the next request. urql is a highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow. TanStack Query provides a set of functions for managing async state (typically external data). useLazyQuery uses the default network policy that of cache-first So I supposed your onClick function actually executes but because the returned value is what was in the cache, React notices no change in data as such the state is not updated since the returned data is what it already has that way no re-render and thing seem not to have changed. const useLazyQuery: (args: Omit<UseQueryArgs, 'variables' | 'pause'>) => UseQueryResponse = (args) => { const firstUpdate = useRef (true); const [variables,. The urql library allows us to easily issue GraphQL queries and mutations. Incremental Static Regeneration (ISR) enables you to use static-generation on a per-page basis, without needing to rebuild the entire site. The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow. It will automatically wrap the page. This is to be able to carr. The second second parameter is the Client being used. 0" Steps to reproduce Instantiate useQuery. All major databases supported: MySQL, SQL Server, Oracle, PostgreSQL & more. I. que realizan tareas idénticas a las que realizan los hooks de Apollo y urql. For background, we suggest reading this comparison between GraphQL and REST. useFragment represents a lightweight live binding into the Apollo Client Cache and enables Apollo Client to broadcast very specific fragment results to individual components. urql is a highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow. By default, we can use the default storage option that @urql/exchange-graphcache comes with. What I'm having hard time doing is initializing urql asynchronously, like this:Introduction. Urql. To mitigate migrating to the new API, we will provide it in different entry points. The thing is it’s only breaking for async atoms. As the GraphQL API walks our query documents it may read from a relational database and entities and scalar values are copied into a JSON document that matches our query document. const { data:doc_data } = useQuery (Get_Doctor); const { data:branch_data, error: branch_error, loading: branch_loading } = useQuery (GET_Branch); You just have to rename the data field to have it work. I want direct query to qraphql backend. query (). But instead of immediately running the query, the pause option is now set to true. To make a query, define a unique key and an asynchronous function to resolve data, as parameters of useQuery…Overview. It's built to be both easy to use for newcomers to GraphQL, and extensible, to grow to support dynamic single-app applications and highly customized GraphQL infrastructure. Another solution is to combine all the screen's queries into one query, put it at the root of the screen with pause: true , and then call that when someone pulls to refresh, triggering all the items below it to re-render on an update. - urql/useQuery. Had the same issue and spent a lot of time without being able to solve it. Both Faction and Ship have identifiers that we can use to refetch them. then () of a promise. the setToken function updates the token in local storage. For example, Apollo gives you direct access to the cache. Learn more about bidirectional Unicode characters. import { Client, provideClient, cacheExchange, fetchExchange } from '@urql/vue'; const client = new Client({. . URQL. I read through the documentation about the cache. type: boolean default: false Set this configuration to true if you wish to tell codegen to generate code with no. Thanks! The onSuccess callback function is called only when the data has been retrieved from the query. React-Query useQuery hooks by default are executed once the component is mounted, which is fine, however it’s not always the case, sometimes we wanted to fetch/refetch queries based on specific actions or conditions. First, install the GraphQL: Language Feature Support extension of VSCode. urqlのQueryのキャッシュは、requestPolicyを設定することで自在に操ることができます。デフォルトの挙動は、cache-first(キャッシュがあればリクエストを送らずキャッシュデータを返す)です。 urqlのキャッシュ戦略(request policy)は4種類で、とてもシンプルです。 @urql/core imports from wonka for stream utilities and @0no-co/graphql. RTK Query takes inspiration from many other data fetching libraries in the ecosystem. query { authors (where: {articles: {rating: {_gt: 4}}}) { id name articles (where: {rating: {_gt: 4}}) { id title rating } } } I wouldn't recommend using the string "where" in your filter clause. This is the most common use case for RTK Query. The @urql/svelte package also exposes a getContextClient function that uses getContext to retrieve the Client in child components. Use graphql query language rather than a language-specific syntax like tagged template literals Improve on the DX for we auto-generate reusable hooks with type-safety and IDE IntelliSense Validate. We can type useMutation hooks the same way we type useQuery hooks. List of Steps: Step 1: Fetch a query stage. page); 3 } jsx. URQL. You need to wrap your app with the Provider component. In this post, we'll cover setting an authentication token and handling multiple users interacting with the same data. But what if you want to execute a query in response to a different event, such as a user clicking a button? The useLazyQuery hook is perfect for executing queries in response to events other than component rendering. On the client side I didn't encounter this so it is. This makes running queries from React components a breeze. 5 introduced new "async and await" methods to provide an easy way of implementing asynchronisity using . Latest version: 4. Apollo Docs. React/Preact. Scoped to data fetching. Allow you to override the naming convention of the output. However, this entails greater complexity when introducing newcomers to the system. # or. GraphQL Tags. If you are using @tanstack/react-query, we recommend using it with graphql-request@^5. Lazy query for URQL. js based library for creating sleek. If the mutation field didn’t return a User, then this wouldn’t be possible, and while we can write an updater in Graphcache for it, we should. Graphcache. Definition Defining your schema . Change the query function signature from: query < Data = any, Variables = object > (store: OperationStore < Data,. This will share one Client with the rest of our app. Duplication on cache update in urql - urql, GraphQL, React. tsx import { NextPage } from "next"; import React, { useState } from "react"; // 1. Apollo GraphOS is the developer platform for building a supergraph: a unified network of your organization's data and services, all composed into a single distributed GraphQL API. This solves the extra re-render issue of React context, eliminates the need for memoization, and provides a similar developer experience to signals while maintaining a declarative. At its minimum with no configuration (!) it's actually a drop-in replacement that's already quite a. # or. type: boolean default: true. The useSubscription hooks comes with a similar API to useQuery, which we've learned about in the "Queries" page in the "Basics" section. Mutations look very similar to queries. js fetches this JSON file (pre-computed at build time) and uses it as the props for the page component. In the example below, the argument of a client function is the property of a query component in Apollo Client. All framework bindings — meaning urql, @urql/preact, @urql/svelte, and @urql/vue — reexport all exports of our @urql/core core. To recap: React Router will allow you to define loaders on each route, which will be called when the route is visited. You switched accounts on another tab or window. I found a solution, it's not the default approach you should take with urql - but it's the only approach you want, if you don't want to wrap around reactive objects to access a single property that's returned from the query. 0. The file is also now exporting FEED_QUERY because you’ll be needing it in a later step to implement some cache updates. Formidable introduced URQL in 2019 as an alternative to Apollo Client. const { data:doc_data } = useQuery (Get_Doctor); const { data:branch_data, error: branch_error, loading: branch_loading } = useQuery (GET_Branch); You just have to rename the data field to have it work. The props that <Query> accepts are the same as useQuery's options object. It's often required to "lazily" start a query, either at a later point or imperatively. npm install --save @urql/exchange-persisted. This allows developers to make async calls more flexibly, as opposed to standard threading/callback methods. I've found I sometimes really need a direct cache access and I don't even know if URQL. This means that client-side page transitions will not call getStaticProps as. Usage. 10. Run your queries on the server before rendering the page HTMLPERSISTED_QUERY_NOT_FOUND: A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache. Thus, there are an indeterminate number of variable combinations - ideas re how should we go about updating the cache to delete the removed member?1 Answer. Can also be a Ref, a reactive object or a function that returns the variables object. That said, cache. 8 React Router cache persistence - React Router does not cache data beyond the currently matched routes. The first item in useLazyQuery 's return tuple is the query function, and the second item is the same result object returned by useQuery. React Query adopts a straightforward, declarative API and relies on React’s rendering cycle to control data. 0. useLazyQuery. In urql, these GraphQL requests are treated as unique objects and each GraphQL request will have a key generated for them. By doing all this, we will reduce a lot of effort in coding typed hooks ourselves before we can use our GraphQL API in our Next. Urql is an advanced GraphlQL client which. To make use of the Client in Vue we will have to provide from a parent component to its child components. js, Svelte, whether you are using Apollo Client, URQL or, React Query. This way, you are making the data-dependency of your component colocated and explicit in the same way that some would colocate the TypeScript definitions or CSS if you are using the styled components pattern. Note: This cheatsheet does assume familiarity with React and GraphQL. urql is a GraphQL client that exposes a set of helpers for several frameworks. A fragment reference is like a pointer to a specific instance of a type that we want to read data from. Installation and Setup. In Apollo, I found this trivial to do by just providing the queries to be refetched upon completion like so: const [ deleteOrderSession ] = useDeleteOrderSessionMutation ( { variables. End-To-End Type-Safety with GraphQL, Prisma & React: API Prep. Reload to refresh your session. It comes with a generic normalised cache built-in, which can be applied to any API, and allows you to specify exceptions to its normal caching logic (cache updates) with your mutations. It doesn't come with normalised caching out of the box, like Apollo or. If you for instance passed a value of 10 for this argument, it means that the first 10 items of the list. It's built to be highly customisable and versatile so you can take it from getting started with your first GraphQL project all the way to building complex apps and. The Route component takes a path prop which is the URL path that the route will match. Schema Directives. Use the client in lazy = false mode which will establish a connection with the server on create and keep it alive. I am initially setting pause to true and manually calling refetch.