-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
WindowScroll IS_SCROLLING_TIMEOUT in dev-mode #717
Comments
This sounds suspicious. If 3 scroll events are fired, I would expect 4 renders: isScrolling:true x3, isScrolling:false x1. |
Can you please confirm that you're actually seeing the true/false/true/false sequence? That is not what I would expect, and if I'm right- changing the is-scrolling timeout shouldn't make any difference on how frequently IE11 fires scroll events. If I'm incorrect, could you provide some sort of Plnkr repro case that I could see? |
What I mean to say, was for every scroll action (aka a user click), I get multiple window.scroll events. The issue comes when the "unscroll" timer code triggers Its probably only a problem because I am displaying simple content when isScrolling=true and complex content when isScrolling=false, the list is constantly flicking between simple/complex cells Let me put together a sample when i get home |
This is the part that still doesn't make sense to me. Why would a re-render cause another scroll event to fire? Why would scroll events be > 150ms apart? I think I'm going to need to see a repro. |
Apologies Brian, I found the underlying cause, my scroll events were taking too long because I had too many synchronous console.log statements littered across the cell render methods. Once I started buffering the console.log statements, then the scroll handler time dropped from >500ms to ~30ms, well within the 150ms threshold. This caught my eye when I was debugging in Chrome Whats your opinion on including performance related warning messages within your lib? Something like this:
|
No problem. I'm glad you figured out what was going on. 😄 Hm. I'm reluctant to add non-RV-specific warnings to RV b'c the library is already pretty hard for a single person to maintain. Specifically the issue you mention above- how would I distinguish between 2 separate scrolls that occur closely together (eg scroll, stop, scroll) vs a scroll with long-running renders like you mention? I think it's okay to close this issue now, given your most recent findings. We can continue to discuss here though. I'd also happily review any proposals (PRs) you have for improving the dev-messaging regarding this use case. |
Hi Brian, sorry to revive this, I think I have a solution. I was digging into the Grid code and stumble upon it's debounce logic that is very similar to the logic in WindowScroller, however Grid's debounce has a configurable timeout. react-virtualized/source/Grid/Grid.js Line 196 in 67f9dc5
This is exactly what I need for the WindowScroller I have been prototyping and found i can set this new prop
And use it like this
Let me know if this approach looks okay to you, and I will create a PR. |
I guess adding such a prop to |
Hi Brian,
I haved noticed that in development
<WindowScroll>
lags a fair bit. Digging into a bit further, I found that a single action (eg a scroll arrow click) in both IE and Firefox triggers multiple onScroll events, whereas Chrome only triggers a single event.Adding some traces to here:
https://github.com/bvaughn/react-virtualized/blob/master/source/WindowScroller/utils/onScroll.js#L39
These are example timings i see:
What happens then, for each scroll event, I seem to get 4 re-paints, in this order:
Some suggest throttling the event:
https://stackoverflow.com/questions/22018348/window-scroll-events-triggering-twice/22018607#22018607
Though I have been playing around with something like this
export var IS_SCROLLING_TIMEOUT = (process.env.NODE_ENV !== 'production') ? 500 : 150;
Is there a better way to configure this when rendering is slower in dev-mode?
The text was updated successfully, but these errors were encountered: