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

Preventing loop in react component #7

Open
pawelkrystkiewicz opened this issue Mar 21, 2019 · 0 comments
Open

Preventing loop in react component #7

pawelkrystkiewicz opened this issue Mar 21, 2019 · 0 comments

Comments

@pawelkrystkiewicz
Copy link
Contributor

Hi!

I am currently using your library in one of my projects to allow user to draw routes that he chooses from side panel.
If user clicks too quick on another route to be drawn there will be multiple routes drawn, because old ones are still awaiting response from HereAPI and are not being properly unmounted. So this creates hot mess.

My solution was to show overlay with loading spinner until routes is drawn with onPathCreated, but to do this I need to update state like: this.setState({loadingOverlay: false}) which triggers rerender and my route is drawn again and triggers setState again... and we are in the loop.
So naturally I thought about shouldComponentUpdate, but this prevents component from using loadingOverlay: false so overlay is still there even after route has finished loading.

Maybe my problem is trivial and I can't see it, but please take a moment for this issue because I've tried for a week now with no results.

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