reexecuteQuery for jotai/urql
See original GitHub issueDo I understand correctly that there is no mechanism at all to reexecute a query in jotai/urql
? In the regular urql
hooks there is this method:
https://formidable.com/open-source/urql/docs/basics/react-preact/#reexecuting-queries
const Todos = ({ from, limit }) => {
const [result, reexecuteQuery] = useQuery({
query: TodosListQuery,
variables: { from, limit },
});
const refresh = () => {
// Refetch the query and skip the cache
reexecuteQuery({ requestPolicy: 'network-only' });
};
};
Not being able to reexecute queries seems like a rather big limitation.
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (14 by maintainers)
Top Results From Across the Web
URQL — Jotai, primitive and flexible state management for ...
atomsWithQuery creates new atoms with a query. It internally uses client.query. import { useAtom } from 'jotai'. import { createClient } from '@urql/core'....
Read more >urql Documentation - React API
The query to be executed. Accepts as a plain string query or GraphQL DocumentNode. variables ?object, The variables to be used with the...
Read more >Why We Need Jotai v2 API - Daishi Kato's blog
Jotai is a library for React state management. ... We call this behavior “extra re-renders without commits”, and it's an expected behavior ...
Read more >jotai/urql.mjs - UNPKG
81, case "reexecute": {. 82, const queryResult = get(queryResultAtom);. 83, if (!queryResult) {. 84, throw new Error("query is paused");.
Read more >Jotai (@jotaijs) / Twitter
Call for document contributors · Discussion #1627 · pmndrs/jotai ... There has been many feature requests for jotai/query and jotai/urql which exceed ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That util would be the perfect temporary measure for now, until the world figures out new design patterns 👍
You’re absolutely right, this is a case of a future pattern not yet having gone through enough discovery to find all the right use cases.
However, combined with a util like that one, this makes it perfectly usable in the real world. I’ll jump over there and see what the state of it is.
On Thu, Aug 26, 2021, 06:56 Daishi Kato @.***> wrote:
Yeah,
fetching
is inreact-urql
. jotai atoms are designed for Suspense and useTransition, which might be too futuristic for now. I understand that distinguishing between the initial fetching and refetching is important in the real use case. We hope to come up with some ideas for bothjotai/urql
andjotai/query
. btw, you might be interested in the new util at #672. Actually, it could solve refetching issue there.Apart from jotai, I wonder how drag to refersh and background refetch will be implemented as best practices in Suspense era.