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
Hi,
I've passed some time trying to update the orginal react-infinite-scroller and shame on me, I didn't see your fork.
I ended making some improvements on the original script (the one your forked), but the most efficient change I did was to debounce the position checking and loadMore things. I've adapted to my needs, hope it's readable.
The idea is very simple :
in the constructor, you set a this.debounceTimeout to null
in the scrollListener you check if this.debounceTimeout is null. If yes, you set it to a setTimeout(load_more_if_needed, 250), if not you just pass your way.
As a window.addEventListener("scroll", this.scrollListener); will fire scrollListener a lot of time, and very fast, it's gonna do some calculations all the time. it's better explained there.
I don't have time and enery to make a pull request from your fork, sorry.
The text was updated successfully, but these errors were encountered:
Agree to @danbovey , it has to be done on the top level components. One idea is to use CancelTokens (in stage-1) now.
For example, axios supports this feature, see here
Just getting back into this component and wanted to make sure I understood the reasoning for not implementing this feature. @danbovey@anupvarghese
I believe what I, and others, are referring to... is not so much the loadMore() callback being passed in, but ALL of the code being executed inside scrollListener(). Those calculations are being made hundreds of times per second without a throttle.
Hi,
I've passed some time trying to update the orginal react-infinite-scroller and shame on me, I didn't see your fork.
I ended making some improvements on the original script (the one your forked), but the most efficient change I did was to debounce the position checking and loadMore things. I've adapted to my needs, hope it's readable.
The idea is very simple :
this.debounceTimeout
to nullthis.debounceTimeout
is null. If yes, you set it to asetTimeout(load_more_if_needed, 250)
, if not you just pass your way.As a
window.addEventListener("scroll", this.scrollListener);
will firescrollListener
a lot of time, and very fast, it's gonna do some calculations all the time. it's better explained there.I don't have time and enery to make a pull request from your fork, sorry.
The text was updated successfully, but these errors were encountered: