Questions tagged [urql]

Formidable urlq GraphQL client

The Formidable Javascript GraphQL client

113 questions
1
vote
0 answers

Urql config with guest token for SSG on next js

So I have a project using the latest Next.js 13, React 18, Urql 3, and using typescript Currently, I have issues when trying to query the urql from the getstaticprops function. My urql request needs a guest token, and I'm storing the token on…
1
vote
0 answers

Urql - What does a second element in query do?

I have defined my query as so: import * as Urql from 'urql'; export function useIsFollowingQuery(options: Omit, 'query'>) { return Urql.useQuery({ query: IsFollowingDocument,…
Penny M.
  • 147
  • 10
1
vote
0 answers

How to serialize Date and DateTime with URQL?

I am using urql-react as my React client in a project. I need to make sure that any date variables in query/mutation with Date scalar type are serialized into YYYY-DD-MM format while for DateTime scalar type, the date object is serialized in…
Kashif Nazar
  • 20,775
  • 5
  • 29
  • 46
1
vote
1 answer

Graphql urql refetch every n seconds

Im using Typescript, React- and graphql with the urql client library. My Query looks something like this: query objectId($id: Int!) { object(id: $id) { id name __typename } } This is how I call the query: const [{ data…
SLNM
  • 69
  • 1
  • 10
1
vote
1 answer

Graphql Codegen specifying optional fields

Say I have the following fragment: fragment ConversationSnippet on Conversation { uuid unreadMessages profileThatHasUnreadMessages updatedAt createdAt profiles{ ...ConversationProfileSnippet } messages{ …
1
vote
0 answers

Delayed requests in urql exchange

How to make an Exchange (cache-and-network) to return data from cache immediately and then wait second and make network request to update cache (offline)?
AHOYAHOY
  • 1,856
  • 4
  • 24
  • 34
1
vote
1 answer

Seeing the URQL cache

I'm looking at customizing how URQL caches API responses by userId, but having trouble figuring this out. I'd like to be able to console log the entire URQL cache, to check what is being stored. Is there any way to do that?
1
vote
2 answers

Why is `urql-cachegraph` `cache.resolve()` expected input / output?

I am following Ben Awad's "Fullstack React GraphQL TypeScript Tutorial" on youtube. It is a few years old, so I am scrambling to modify the code to work with updated packages, specifically here urql-graphcache. If you are also following along, I'm…
NicoWheat
  • 2,157
  • 2
  • 26
  • 34
1
vote
2 answers

Urql cache invalidate is not removing items from the cache

My application has a list of organizations and I have buttons in my UI to delete them individually. I would like the list to update and remove the deleted organization but that is not working for me. I have set up a cache exchange like this, where I…
brendangibson
  • 2,377
  • 2
  • 21
  • 36
1
vote
2 answers

Nextjs urql subscription exchange import problem

i can't get urql subscriptions to work with NextJS because of imports problem. Basically i'm using this graphql-ws lib that is recommended in urql docs, that needs ws implementation library (eg: 'ws'). And when i import WebSocket from 'ws' i get…
dankobgd
  • 367
  • 3
  • 9
  • 31
1
vote
1 answer

Graphql-ws: separate websocket connection is opened for each subscription

I'm a newbie in websockets. I use urql and graphql-ws (migrated from subscriptions-transport-ws) to get graphql subscriptions. The code is following: export const useUrqlClient = () => { const headers = useHeaders(); const client = useMemo(() =>…
1
vote
2 answers

Svelte and urql: operationStore isn't reactive?

When a prop passed from the parent changes, and is used as a parameter of an urql query, the query does not seem to be reexecuted. I see many examples such as: export let id; const store = operationStore(query, { id }) query(store) But why there…
user2923322
  • 1,072
  • 1
  • 11
  • 25
1
vote
2 answers

Form handling using cache-and-network policy, how can I handle this case?

I'm using urql and Svelte for a new web app. I ran into a logical problem that I can't figure out how to best solve. Suppose I have many todos and the list of these todos is already cached on my phone browser. While I'm on the subway (very slow…
Fred Hors
  • 3,258
  • 3
  • 25
  • 71
1
vote
1 answer

GraphQL Mutation returning null only when I reload the page

I am using nextJS and urqlClient for ssr. I have ssr turned off in all my pages at the moment. The issue that i am facing is the following. I have profile page which renders data after fetching the user from graphql. If the user is not found it will…
Charles Semaan
  • 304
  • 2
  • 13
1
vote
1 answer

Vite hotloading shows inconsistent results. Why

I have a Vite + Typescript + Vue 3 SPA using "script setup". The app uses Urql to query a GrapgQL endpoint. I have a situation where query works and displays rows only after the component with the component is hotloaded. Sequence of events: load…
maxweld
  • 229
  • 2
  • 15