Debounce fetchexchange if cache was hit? #1857
-
As the title reads, how would I go about debouncing the fetch from fetch exchange for x seconds iff cache exchange has returned data? The use case is pagination in a cursor based pagination on already viewed pages. Without a debounce, unecessary strain is put on the server serving stale requests when the user is moving back to previous pages. My current guess is a custom debounce exchange between cache exchange and fetch exchange, but Im not familiar with wonka/guts of urql, so not sure if this is the correct path. Edit: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey, I wonder if the requestPolicy exchange would be a better fit for this use case, instead of always using |
Beta Was this translation helpful? Give feedback.
Hey,
I wonder if the requestPolicy exchange would be a better fit for this use case, instead of always using
cache-and-network
it will look at the staleness of a certain request and upgrade the operation if needed.