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
I'm using SWR as a global cache for an app where I leverage https://github.com/react-forked/dnd to implement a drag and drop based list reordering. As explained in the doc , it works well when using useState's setter to update the list order on drag-drop since it is batched in the next React render. When using swr I'm getting a flickering effect that I suspect is due to the "asynchronous" nature of the mutation. See below:
Is there a way to run a mutation synchronously so that the change can be batched by React and avoid flickering?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using SWR as a global cache for an app where I leverage https://github.com/react-forked/dnd to implement a drag and drop based list reordering. As explained in the doc , it works well when using
useState
's setter to update the list order on drag-drop since it is batched in the next React render. When using swr I'm getting a flickering effect that I suspect is due to the "asynchronous" nature of the mutation. See below:Is there a way to run a mutation synchronously so that the change can be batched by React and avoid flickering?
Beta Was this translation helpful? Give feedback.
All reactions