-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stuttering/Flickering issue #1060
Comments
I have noticed that this issue is non existent on Chromium 71. I have not tried regular Google Chrome but I assume it is the same. |
Okay, so, edit number 2. Strangely, I have discovered that when I close my development tab, then re-open it and try to reproduce the issue, I am unable to. But if I subsequently refresh the page, the issue is there again. To make that more clear: Open firefox -> go to localhost:3000/ -> issue is not present -> refresh page -> issue is present The same is true for Chrome, only it's not refreshing the tab that causes the issue to start happening, it is entering responsive mode. Refreshing on chrome seems to fix the issue. |
Looking futher into this I have realised that the reason this is happening is that after refreshing the firefox tab, each time the state is updated, a GET request for the image(s) that had their positions moved in the list is fired off, and whilst the GET request is waiting to be fulfilled, I think the images display their alts. |
Okay sure. So it sounds like an image loading issue. Is there anything you would like me to look into? It sounds like an image preload issue |
@cooperfrench95 Did you end up finding a workaround for this? I'm getting this issue as well, causing my images to jump exactly like in your example. It's happening for me in Safari/Firefox, and works fine in Chrome. |
I didn't end up finding a workaround, unfortunately. I believe it is just
an issue of how the browser loads images. Lazy-loading or having a
placeholder might be the best bet.
…On Fri., 26 Apr. 2019, 1:49 pm ankers.json, ***@***.***> wrote:
@cooperfrench95 <https://github.com/cooperfrench95> Did you end up
finding a workaround for this? I'm getting this issue as well, causing my
images to jump exactly like in your example. It's happening for me in
Safari/Firefox, and works fine in Chrome.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1060 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKW6M2HOL77XYKLVYYZE4NTPSKJXXANCNFSM4GRERIHQ>
.
|
I would be happy to add a guide if somebody creates a good solution for this! I will stay away from fiddling myself for now |
Hey guys! I would suggest using React.memo to stop the re-rendering of the image. It did the job in my case. |
See #1311 |
I second this! In my use-case, I want my ui to be indicative of server state. My items where flashing in their new positions onDragEnd, reverting whilst API processes, then the component would reload with the updated server state. Removing my content from view whilst changes are applying improved the UX. NOTE: I'm using RTKQuery and on successful mutation, in this case useMyUpdateItemsMutation, the cache is invalidated and my reliant component reloads, causing data to change, thus the code inside my useMemo is executed.
Thanks for pointing me in the right direction @devias-io |
I am having the same issue but it is not with images. So I think this is an issue that persists still. This is what probably happening:
The flickering happens between 4 & 5. |
Hi, have you had any luck discovering a solution? |
Hello. I had the same issue. Drop the item and it would look normal The Solution i did was to create a variable on this js file to hold the state immediately so that on step 3 it will have the latest changes. So instead of rendering the state do this instead 2)inside the component add
I'm not sure if this will work if this component is multiple times in the same page since the stateHelper will be common for all the components. |
Bug or feature request?
Bug
Expected behavior
Draggables slot in to their new positions smoothly after dropping, without any flickering or stuttering.
Actual behavior
When a draggable is dropped, there is a split second where it seems like perhaps the state is still updating, and during that split second, if the item is an image, the old item in that position is displayed. If the item is a block of text, then during that split second it just kind of moves slightly (and I notice that the styles change in the console). I notice that this is worse the more draggables are in the list, and particularly the more image draggables that are in the list. I have some images and some text blocks in my list of draggables.
I am using redux elsewhere in my application, but I'm not using it in this file. I'm not firing off any API requests or anything like that either.
The console shows no errors or warnings.
Steps to reproduce
Here is my js file:
What version of
React
are you using?16.6.3
What version of
react-beautiful-dnd
are you running?10.0.3
What browser are you using?
Firefox 64
Demo
The text was updated successfully, but these errors were encountered: