Questions tagged [urql]

Formidable urlq GraphQL client

The Formidable Javascript GraphQL client

113 questions
0
votes
0 answers

urql, GraphQL: cache not updating on mutation (with nested input object)

UPDATE: I solved the problem, but I'm not sure totally sure how. The code seems the same to me, but data is showing up now. Any new answers are still welcome! So I have a cache updater for a mutation called createMeanings. (The mutation basically…
vls9
  • 113
  • 10
0
votes
0 answers

How can i async await in setting fetchOptions in a createClient function in urql

I want to fetch the token from async-storage but it returns a Promise of type string or undefined. Since fetchOptions is a function that returns a object of type RequestInit here is what i've tried export const client = createClient({ url, …
crispengari
  • 7,901
  • 7
  • 45
  • 53
0
votes
0 answers

URQL not setting the cookies in the browser

I have a nextjs application that is consuming a graphql api that is served using fastify. Here is how I'm creating a client and a Provider: import React from "react"; import { createClient, Provider } from "urql"; export const url =…
crispengari
  • 7,901
  • 7
  • 45
  • 53
0
votes
0 answers

Urql Client and Fastify mercurius returns data as undefined in the React App

I have a urql and fastify server that looks as follows: import "reflect-metadata"; import "dotenv/config"; import _ from "node-env-types"; import Fastify from "fastify"; import mercurius from "mercurius"; import { buildSchema } from…
crispengari
  • 7,901
  • 7
  • 45
  • 53
0
votes
0 answers

How to iterate useQuery with payload inside or outside onMounted

i am trying to iterate over a query that requires as variable. The first thing i tried was doing it inside onMounted like this: onMounted(async () => { arrayOfObjects.value.forEach(async (object: ObjectType) => { const { data } =…
Marnix Elling
  • 335
  • 1
  • 3
  • 15
0
votes
1 answer

Graphql Codegen Duplicating Document Fields

I have setup codegen.ts as follows: import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { overwrite: true, schema: 'http://localhost:3333/graphql', documents: 'libs/graphql/**/*.graphql', …
Kelveen
  • 90
  • 7
0
votes
1 answer

Next 13: how do I fetch data for server components every time there is a request with Urql Graphql

I currently have the following server component at the route /app/account/page.tsx: const AccountPage = async () => { const username = await getViewer(); return ; }; I expect getViewer to be run every…
Anthony Bias
  • 515
  • 3
  • 20
0
votes
0 answers

Unable to upload file graphql urql

I got empty object while uploading image. I follow all the step provided, but still can't make it solve. The error said "Variable "$file" got invalid value {}; Upload value invalid." const client = createClient({ url:…
surya kumara
  • 185
  • 1
  • 11
0
votes
0 answers

urql caching in nextjs on the server side. avoiding multiple api calls

i am not able to implement urql caching in nextjs the problem is described in the readme of this repository https://github.com/prasoonchatterjee/urql-caching/tree/main i tried using the documentation but it wasnt that clear to me so i uploaded a…
0
votes
0 answers

Update components state on Urql cache write

My React component receives data from an Urql query this way: const [variables, setVariables] = useState({ limit: 10, cursor: null }); const [{ data, fetching }, refetch] = useQuery({ query: postsQueryDocument, variables }); useEffect(() => { …
El Anonimo
  • 1,759
  • 3
  • 24
  • 38
0
votes
0 answers

Using Vue Composition API with Pinia

I have a Vue 3 project and I'm working with Composition API. I'm communicating with my backend using Urql which is a graphql library which allows me to wrap API requests as composables. I'm new to Pinia, but after a bit of time working with Vue 2 +…
Shay Yzhakov
  • 975
  • 2
  • 13
  • 31
0
votes
1 answer

Urql Authentication: addAuthToOperation compile error

trying to add Authorization header to GraphQL requests, following instructions from https://formidable.com/open-source/urql/docs/advanced/authentication/ type AuthState = { token:string }; return authExchange({ addAuthToOperation:…
0
votes
1 answer

CombinedErrors graphQLErrors Unknown argument limit on field Query.posts - Trying to pass argument to query using urql, Strapi, Next JS

I'm trying to use a variable to pass in limit as an arg to my GraphQL query. I'm using urql and Strapi with its GraphQL plugin in a Next app. I want to add a limit variable to limit the rows returned. I'll provide an example below followed by the…
abgregs
  • 1,170
  • 1
  • 9
  • 17
0
votes
1 answer

How to separate GraphQL queries from string in URQL?

I am developing a GraphQL testing tool. Let's say I have an input field where users can write down the query and click on the run button to run the query. query Message { messages { user content } } subscription RealtimeMessage { …
Anwarul Islam
  • 561
  • 7
  • 29