useOptimistic causes a flash just before revalidating #54247
Unanswered
prateek3255
asked this question in
App Router
Replies: 2 comments 1 reply
-
|
same issue here |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Still an issue in Next 15 RC (React 19 RC) |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
I wanted optimistic state updates with server actions so I reached out for the
useOptimistichook. But when the content is revalidated there is a flash of previous state for some reason. This is a minimal version of what my client component looks like, thehasLikedprop is passed by the parent server component which is revalidated when the when the action is triggered:This is the flash that happens just before revalidation:
Screen.Recording.2023-08-19.at.1.32.11.AM.mov
Here is a minimal reproducible codesandbox with the example used above:
https://codesandbox.io/p/sandbox/green-leaf-8f3dkq?file=/app/LikeButton.tsx
I am not really sure, what I am doing wrong here.
Beta Was this translation helpful? Give feedback.
All reactions