-
Notifications
You must be signed in to change notification settings - Fork 8
The Map component's declared event listeners are being re-attached on every state update #773
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
Comments
I found the culprit, but am not quite sure the best resolution. This line here is being called on every state update, which calls updateInstanceFromProps with Line 79 in eb64b23
Maybe
And then the line in Map.js above could be adjusted like so:
I don't know the project well enough to know what ill side-effects that could have, though. Regardless, I'm happy to help however I can! |
Thanks for the report, @shawncrawley - and for identifying the root of the issue. I put together a fix in #774, and will cut a release with that before long. |
Thanks for the quick work on that! Again, happy to have helped. Looking forward to the release. |
The Thanks again for digging into this and opening the issue. |
Uh oh!
There was an error while loading. Please reload this page.
I discovered that the Map component's declared event listeners are being re-attached on every state update, which results in the listener firing
n
times per click, wheren
is the number of times the parent component's state has been updated since its initial render.Here's a minimal example, which can be copied and pasted into https://code.esm.sh and reproduced by clicking on the map a few times and then opening the console and checking the log statements. The first click yields one log statement, while the second click results in two (i.e. three total), the third in three (six total), and so forth.
The text was updated successfully, but these errors were encountered: