Tag: urql
-
How to update query on route change using Vue and Urql
0 I’m trying to find a way to update my query when the route changes (same component). The query is being selected using route meta data. Between Vue router’s navigation guards, hooks, watching for changes, etc, and Urqls "useQuery," I can’t figure out how to structure it to give me new data when the route…
-
What plugin should I use to generate types for a server-side only library?
0 I have a working codegen.yml example using: src/generated/graphql.tsx: plugins: – typescript – typescript-operations – typescript-react-apollo that works great for our front end code making a tsx final result used with react. Over in my other project: src/generated.ts: plugins: – "typescript" – "typescript-operations" – "typescript-document-nodes" I’ve replaced typescript-react-apollo with typescript-document-nodes and sometimes I can get…
-
How to allow Urql (typescript) to accept Vue reactive variables for queries created with graphql-codegen
2 I’m building a Vue project with urql and graphql-codegen. Urql has the ability to take Vue reactive variables when using useQuery() to enable useQuery to be reactive and update when the variables do. But graphql-codegen is creating the type for the variables parameter to require scalars (ex. string) and so typescript is throwing an…
-
How to implement error handling globally for URQL GraphQL mutation?
0 My stack is: react v17.0.2 graphql v16.8.0 graphql-ws v5.14.0 urql v4.0.5 I use Hasura Actions to connect to REST API and I need to implement global error handling for all mutations. For example I have useAuthentication hook that returns a signOut promise: import { useMutation } from ‘urql’; export const useAuthentication = () =>…
-
Custom hook to log request and errors while using either useQuery or useMutation?
0 Requirement: Create a custom hook (useLoggedAPI) to call either useQuery or useMutation and add logs for request or errors. This utility function will be reused everywhere where there’s an GQL API call. What I have tried so far: /* eslint-disable @typescript-eslint/no-explicit-any */ import { useQuery, useMutation, AnyVariables, UseQueryArgs, DocumentInput, CombinedError, UseQueryResponse, UseMutationResponse, } from…
-
How can graphQl update its won cache in reaction to data mutations triggered by a different user?
0 Here is a scenario: User A is friends with user B. User C is an admin. When user A queries the list of his friends, the list comes back, and user B is one of its members. This list is cached and the following queries are read from the cache. Now, let’s say the…