How to properly render from "cache" without useQuery #1979
-
Hard question to write, but easy to show if I expose a "classic" use case. Let's suppose:
Now, I'm in a position where I cannot use useQuery anymore, because I have 1 milion todos and I have to implement an infinite scroller, therefore, I'll use useClient and perform manual queries with pagination. Suddenly, my mutation will update the cache, but my todo will not rerender again, because I have nothing that listen to the cache change like useQuery was doing. I have several ideas, but nothing that makes me happy, how I can achieve what useQuery was doing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Instead of using a promise you should open a subscription with the help of the wonka library which the react library uses under the hood. However why would you not use useQuery, pagination can still be used like this example https://github.com/FormidableLabs/urql/blob/main/examples/with-pagination/src/PaginatedNpmSearch.jsx |
Beta Was this translation helpful? Give feedback.
Instead of using a promise you should open a subscription with the help of the wonka library which the react library uses under the hood. However why would you not use useQuery, pagination can still be used like this example https://github.com/FormidableLabs/urql/blob/main/examples/with-pagination/src/PaginatedNpmSearch.jsx