You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the react Example given for useOptimistic hook in docs, an update in state passed to the hook should directly reset the optimisticState in one render.
Instead
It calls the updaterFn first, updates the optimisticState using new state and optimisticValue during one render cycle
resets optimisticState with new State in another render cycle.
As a result, both the new state and optimisticValue is rendered. Tried this in 20x slowdown
Screen.Recording.2024-12-31.at.1.30.15.PM.mov
React version: 19
Steps To Reproduce
Throttle CPU to 20x slowdown
Type some input in text box and press submit
See that the optimistic state is displayed and then it is pushed down for an instant along with the new state
Using the react Example given for useOptimistic hook in docs, an update in state passed to the hook should directly reset the optimisticState in one render.
Instead
As a result, both the new state and optimisticValue is rendered. Tried this in 20x slowdown
Screen.Recording.2024-12-31.at.1.30.15.PM.mov
React version: 19
Steps To Reproduce
Link to code example:
https://codesandbox.io/p/sandbox/react-dev-forked-gmlxnr?file=%2Fsrc%2FApp.js&workspaceId=ws_QiCvK4c476hege6EDsXfpC
The current behavior
When new state is passed to useOptimistic,
The expected behavior
When new state is passed to useOptimistic, it should directly reset the optimisticState without calling the updater Fn
The text was updated successfully, but these errors were encountered: