-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
set zoom guard, fixing illegal matrix errors #6921
Conversation
Thanks for the PR @hyperknot (and sorry for the delay in responding to #6782). My concern is that this fix will hide the underlying errors that result in zoom being set to a NaN/non-number value. I'd be more in favor of making the check in |
Yes, I agree that the underlying cause needs to be fixed, but I wanted to make sure that the map is never frozen for any user. I'm running a custom build just for this reason. How does a failed assert in core look for users? Everything keeps working and it's just an error in console? If so I'm happy to change the code. |
A failed assert would be equivalent to throwing an exception, so no, everything would not keep working -- but it would mean that "failed to invert matrix" would be replaced with a more precise error, thus making future bugs of this sort quicker to diagnose and fix. I agree that the map shouldn't be frozen for any user, but I'm still not convinced that placing a blanket guard in The particular error from the ScrollZoom handler should really have been caught by Flow. It wasn't, because
|
Then it's up to you how do you see the timeline of properly fixing the handler bugs. My solution would be a temporary fix for user experience, until everything is polished out in scroll_zoom. |
Fixed in #6924 Thanks for helping to move this forward, @hyperknot ! |
@anandthakker so what's with transform.js? I feel it's important to put the guard in there as well. |
see: mapbox#6924 Closes mapbox#6782 Closes mapbox#6486 Replaces mapbox#6921
Launch Checklist
@mapbox/studio
and/or@mapbox/maps-design
if this PR includes style spec changesNo changes, no new functionality, just a guard to make sure that zoom cannot be set to NaN, and thus turn the map into a frozen state.
Detailed description about how can set zoom receive a NaN value:
#6782
Those issues can be fixed in the future, if needed, but this one makes sure that the map never ends up in a broken "illegal matrix" state.