fix: resync map overlay after backgrounding to fix misalignment - #713
fix: resync map overlay after backgrounding to fix misalignment#713EthanShoe wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
AirTrail AI Review identified 2 new actionable issues.
How can I respond to a finding?
- Fix it: push a new commit; AirTrail Helper will recheck the finding.
- Question or challenge it: reply in the finding thread and mention
@airtrail-helper. - Maintainers: resolve the thread to dismiss the finding.
There was a problem hiding this comment.
AirTrail AI Review identified 2 new actionable issues.
How can I respond to a finding?
- Fix it: push a new commit; AirTrail Helper will recheck the finding.
- Question or challenge it: reply in the finding thread and mention
@airtrail-helper. - Maintainers: resolve the thread to dismiss the finding.
| const target = targetForArcs(intent.arcs, intent.projection, padding); | ||
| if (!target) return; | ||
| const MIN_OVERVIEW_ZOOM = 1; | ||
| const appliedZoom = Math.max(target.zoom, MIN_OVERVIEW_ZOOM); |
There was a problem hiding this comment.
Medium — Preserve the zoom required to fit all arcs
Clamping the computed fit zoom to 1 breaks the fit contract on narrow viewports or geographically broad datasets: bounds that require zoom below 1 are cropped, so some airports and routes remain off-screen. Use the zoom returned by cameraForBounds, or apply a minimum only when the bounds are still proven to fit.
AirTrail Helper reviewed a1c44a1 · AI-generated finding; verify important details.
There was a problem hiding this comment.
Well, this is true I think. But I'm pretty sure this was also the main cause of the bug. :/
| pendingVerifyTimer = null; | ||
| if (!isDeckCanvasMisaligned()) return; | ||
| if (attempt >= MAX_RESYNC_ATTEMPTS) { | ||
| window.location.reload(); |
There was a problem hiding this comment.
Medium — Avoid reloading indefinitely on persistent canvas mismatch
If the two backing canvases remain more than two pixels apart—for example because their WebGL contexts apply different device-pixel or maximum-buffer sizing—this reloads the page, and the next pageshow repeats the same verification and reload indefinitely. Keep retrying or disable/recreate the overlay without navigating, rather than making persistent size equality a reload condition.
AirTrail Helper reviewed a1c44a1 · AI-generated finding; verify important details.
|



Fixes #712
@johanohly - Full disclosure, this code was completely vibe coded. I debugged this issue for a while with Claude and I am more opening this PR to show what actually ended up fixing the issue for me and hopefully make it easier for you to write a real fix if this code is not sufficient.
Note
Resync the map overlay after resume and stabilize overview camera fits
AirTrail Helper summarized cf10d46 · AI-generated summary; verify important details.