Replies: 1 comment 5 replies
-
IMO you can create
const fetcher = useCallback(() => ..., [dep1, dep2])
dep1 && dep2 && <ComponentUsingSWR /> |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
hey, i am trying a case of
depends data
, see this linkIntuitively, I expected swr will auto retry in this case, so i write code like this, but, it's not working ...
Just throw exception
Cannot read property 'id' of undefined
.I only can do this behavior by passing a function to first arguments. see this link
Can we automatically retry when a revalidate throws an exception and this revalidate has
depends data
?Consider this case, it's has multiple
depends data
, it's will let keyFunction to be complexif can automatically retry, we just need to write that.
We can use
await
, but it will lose parallelism, if there have another request afterx
Or, we can add a new
options
likedepends
?When all depends is ready, then execute revalidate ?
It's like
hmmm...
In fact, I think
retry
is not good, because there is a problem with the depends data itself, such asdata3.attr = null
, in this case, we should't retry ...Beta Was this translation helpful? Give feedback.
All reactions