Skip to content

fix: restore map rendering by upgrading react-map-gl to v8 - #13

Merged
iblh merged 1 commit into
mainfrom
fix/map-react-map-gl-v8
Sep 13, 2026
Merged

iblh merged 1 commit into
mainfrom
fix/map-react-map-gl-v8

Conversation

@iblh

@iblh iblh commented Sep 13, 2026

Copy link
Copy Markdown
Owner

The bug

The landing page's live route preview renders its frame, stats and attribution, but no basemap tiles and no route line. This affects every map in the product, not just the landing page — Dashboard.tsx and demo/DemoDashboard.tsx render the same MapContainer.

Root cause

#4 bumped maplibre-gl 4.7.1 → 6.4.1 to fix a critical XSS advisory. But react-map-gl@7.1.9 declares:

"maplibre-gl": ">=1.13.0 <5.0.0"

Installing v6 violated that range. 7.x's mapbox-legacy/utils/transform calls .clone() on a maplibre internal that v6 reshaped, so the map mounted a canvas and then threw before painting anything:

TypeError: Cannot read properties of undefined (reading 'clone')

That is exactly the compatibility risk flagged when #4 was merged — the security fix was right, this is the fallout.

The fix

Upgrade to react-map-gl@8.1.3, which re-exports the same components from @vis.gl/react-mapbox / @vis.gl/react-maplibre. Those declare maplibre-gl: ">=4.0.0" — no upper bound — so v6 is supported and the security fix stays in place.

v8 drops the root export, so one import moves:

  • from 'react-map-gl'from 'react-map-gl/mapbox'
  • from 'react-map-gl/maplibre' — unchanged

Verified before changing the import: all five components used here (Source, Layer, Marker, NavigationControl, FullscreenControl) exist on both subpaths, and mapbox-gl@3.18.0 already satisfies @vis.gl/react-mapbox's >=3.5.0 floor, so no second bump is needed.

Test plan

  • pnpm lint — clean
  • pnpm typecheck — clean (would have caught any v8 API drift)
  • pnpm test — 35 passed, 6 skipped
  • pnpm build — ok
  • Lockfile resolves react-map-gl@8.1.3(mapbox-gl@3.18.0)(maplibre-gl@6.4.1) with no peer violation
  • Dev server: the clone TypeError and Can't resolve 'react-map-gl' errors are gone from a clean page load
  • Visual check needed in a real browser — see below

⚠️ What I could not verify

I could not visually confirm that tiles actually paint. My headless browser cannot composite WebGL: loading production uplotr.com (unmodified, pre-fix code) in the same browser produced an identical blank canvas and readPixels[0,0,0,0]. Since that is the code this PR does not touch, the blank canvas is a limitation of my tooling, not a signal about this change.

So the evidence here is that the crash is fixed (console errors gone, peer range satisfied, build green). Someone should open the preview deployment in a real browser and confirm the basemap and the blue route line both render — on the landing page, /demo, and the dashboard.

🤖 Generated with Claude Code

#4 bumped maplibre-gl 4.7.1 -> 6.4.1 to fix a critical XSS advisory, but
react-map-gl@7.1.9 declares `maplibre-gl: ">=1.13.0 <5.0.0"`. Installing
v6 violated that range, and 7.x's transform helper called .clone() on a
maplibre internal that v6 reshaped, throwing:

  TypeError: Cannot read properties of undefined (reading 'clone')

The map mounted a canvas and then died before painting tiles or the route
line, which is why the landing preview showed its frame, stats and
attribution but no map.

react-map-gl@8.1.3 re-exports the same components from @vis.gl/react-*,
which declares `maplibre-gl: ">=4.0.0"` and so accepts v6. v8 drops the
root export, so the mapbox import moves to 'react-map-gl/mapbox'; the
'/maplibre' subpath is unchanged. All five used components (Source, Layer,
Marker, NavigationControl, FullscreenControl) exist on both subpaths, and
mapbox-gl@3.18.0 already satisfies @vis.gl/react-mapbox's >=3.5.0 floor.

This affects every map in the product, not just the landing page:
Dashboard and DemoDashboard render the same MapContainer.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
uplotr Ready Ready Preview Sep 13, 2026 3:25am UTC

@iblh
iblh merged commit 56e7cd7 into main Sep 13, 2026
4 checks passed
@iblh
iblh deleted the fix/map-react-map-gl-v8 branch September 13, 2026 05:45
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

Successfully merging this pull request may close these issues.

1 participant