new feature: add revalidateReason to indicate which reason to cause revalidate. #4136
Unanswered
lovetingyuan
asked this question in
Ideas
Replies: 1 comment
-
This is something I've been missing sometimes. For example, cases where my query returns data for different parts of the UI, but when I revalidate, I want to show a different UI depending on where I triggered the revalidation. |
Beta Was this translation helpful? Give feedback.
0 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.
-
In SWR, many factors can trigger revalidation. I'd like to know the specific reason for each revalidation, such as focus, error retry, or interval, etc.
const { data, isLoading, isValidating, validateReason } = useSWR()
when validateReason is updated, I know the new data is fetched and I also know why the api is refeched.
Beta Was this translation helpful? Give feedback.
All reactions