Replies: 1 comment
-
I think the root cause is that your |
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.
-
See https://github.com/joulev/debug/tree/swr-after-mutating.
Currently I have this
What happens is that when
alert
is called, whileisRevalidating
isfalse
, the data inobj
is still the old data. Only after I close the alert willdata
be assigned the new values.How do I ensure that the function
doThisAfterMutating
will run afterdata.date
has been updated?This is actually an XY problem. In my original use case,
doThisAfterMutating
doesn't need the value ofdata
(so I don't really need the promise returned bymutate()
), but will execute something likesetIsLoading(false)
after the data has been fully revalidated. Currently that would lead to some split second whereloading === false
while the rendered data is still the old data. I want to ensure thatsetIsLoading(false)
is only called after everything is fully rerendered.Beta Was this translation helpful? Give feedback.
All reactions