Closed himself65 closed 3 weeks ago
Please see preview in https://github.com/himself65/intro/pull/17
Something like #736? Does it work for you?
let me try
startTransition(async () => {
setOptimisticVotes(+1)
await vote()
await refetch('')
})
On second thought, it's not because of async refetch. It's because of await vote()
. Let me draft another PR.
It's because of
await vote()
What do you mean by await vote?
With the line await vote()
, it loses a transition.
Not because of vote()
, but await Promise.resolve()
would reproduce.
Let me merge #737. I will re-investigate it if it doesn't fix your issue.
With the line
await vote()
, it loses a transition.
Doesn't startTransition
support async function?
It's working now
With the line
await vote()
, it loses a transition.Doesn't
startTransition
support async function?
Yes and no. After await
it's not in the transition.
Very simple logic using server action +
useOptimistic
+startTransition
https://github.com/dai-shi/waku/assets/14026360/9fb42a8e-0e2a-470b-bfd1-956b9c6aa127
I found that there's a flicking because refetch is actually an async network, but
startTransition
cannot await itServer Actions