Skip to content
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

Event fires faster than state update #150

Open
madnight opened this issue Oct 13, 2017 · 0 comments
Open

Event fires faster than state update #150

madnight opened this issue Oct 13, 2017 · 0 comments

Comments

@madnight
Copy link

madnight commented Oct 13, 2017

Example: lets say we have a counter that should count to 10 and every scroll event increases the counter by +1. If the counter state is greater or equal to 10, then our increase state handler does nothing. Now lets assume the counter state is at 9 and we scroll very fast, so that new scroll events get triggered and processed asyncronously (thats the important point), so that the event handler in foldp reads the old state value of 9 and increases it by one. Now we look at the counter and it shows 13, although we never expect it to be more than 10.

I'm not exactly sure if its possible to reproduce the problem with simple counters, the problem that i have is a ajax request plus list mappend, with too many requests and appends if i scroll too fast, but not so if i scroll slowly so that a new event reads the updated state.

How do i solve this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant