search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

unexpected scroll on init | incorrect onScroll behavior |infinity scroll loop

Asked by senioro
2 years ago.

I took an example - and just modify the onScroll function:

onScroll(args) {
const { viewport } = args;

this.props.loadItemsRequest(viewport.start, viewport.end);
// I load data and save it to the redux store and I provide "events" prop to the Scheduler
// After events prop change I have unexpected scroll

P.S. onScroll is called not only after scroll, onScroll is called after init, props update and scroll.

I can't fetch data into onScroll method, that's is not a good idea and I have to store it to the state and process into a selector (redux staff)

I'm using

Answer posted by Dan Letecky [DayPilot]
2 years ago.

You must not assign the events attribute in onScroll. This causes the change detection mechanism to refresh the Scheduler and fire another onScroll event.

See also a related question (it's for Angular but the logic applies here as well):

The onScroll event is not the native onscroll event and the behavior is different, by design. Its purpose is to provide an event that will supply event data during scrolling. That's why it's called after init and after every update.

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.