Repository navigation
chore(deps): upgrade react-map-gl to 8 through its Mapbox entry - #445
Merged
Merged
Conversation
react-map-gl 8 has no root entry: every import moves to `react-map-gl/mapbox`,
the endpoint for mapbox-gl 3.5 and later. mapbox-gl stays at 3.35.0.
Its types are now mapbox-gl's own, which are stricter in three places:
- `GeoJSONSource` is no longer re-exported, so `Map.tsx` takes it from
mapbox-gl as a type.
- A GeoJSON source's `data` must carry `properties` and a geometry. The
highlight source gains `properties: {}`, and the events source drops the
online classes, whose geometry is null. Mapbox skipped those features
anyway, clustering included, so nothing drawn changes.
- `LayerProps` admits a `slot` layer, which takes no zoom range, so the
highlight layers `PointSource` bounds by zoom are typed as the symbol
layers they are (`SymbolLayerProps`).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVeNzer8ue5c7JRsZk
react-map-gl 8 types `<Map>` with mapbox-gl's own `MapOptions`, which lists
`language`. The spread that carried it past the excess-property check is no
longer needed, so a misspelt prop name now fails `tsc`. The attribution spec
pins the plain prop instead: watched failing against `language={languageCode}`.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVeNzer8ue5c7JRsZk
react-map-gl 8 moves its `import('mapbox-gl')` from module scope into
`<Map>`'s mount effect (`@vis.gl/react-mapbox`'s `components/map.js`), so
the comments resting on the module-scope fetch were wrong:
- An eager react-map-gl import costs its own code, which `pnpm size` counts:
measured, one `useMap` import in `use-map-controller.tsx` put both graphs
over budget by 2.1 and 3.2 KiB. The seam warnings keep their rule and say so.
- The node lane loads `use-mapbox.ts` now (probed with a throwaway spec), so
`store.ts` says why the camera flag lives there rather than that it must.
- `MapFrame.test.tsx` still cannot render `FullInterface`: mounting the map
fires the import.
- The map instance arrives once that import resolves, not a microtask after
the mounting commit.
The lazy `FullInterface` boundary (#161) is unchanged, and the history of
what react-map-gl 7 cost a compact embed stays, tagged with its version.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVeNzer8ue5c7JRsZk
react-map-gl 8's `<Popup>` applies a new `anchor` only inside the branch for a changed `offset` (`@vis.gl/react-mapbox`'s `components/popup.js`); 7 applied it on its own. The pin popover stays mounted while the pointer crosses from one pin to the next, so two anchors sharing an offset would leave the second card on the first pin's side. `pinPopoverPlacement` gives each of its six anchors a distinct offset today; this pins that. Watched failing with the horizontal offset forced to 0 (2 distinct offsets for 6 anchors). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVeNzer8ue5c7JRsZk
react-map-gl 8 imports mapbox-gl from `<Map>`'s mount effect, which waits for the whole interface to commit. Measured on a production build served locally (4 loads each), the library's request started 3-4ms after the lazy interface chunk under react-map-gl 7 and 442-457ms after it under 8, and the library is the map's long pole. `Map.tsx` now hands react-map-gl the import as `mapLib`, started by the map's first render through a memoised loader: 0-9ms after the chunk again. The loader stays out of module scope, so a `map=false` embed, which imports `Map.tsx` through `FullInterface` but renders no map, no longer downloads the library, which react-map-gl 7 fetched there too. The attribution spec pins both halves: watched failing with the prop dropped, and with the import moved to module scope. The comments describing where mapbox-gl is fetched now say `mapLib`, and CHANGELOG records the `map=false` change; no origin, CSP or Permissions-Policy change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVeNzer8ue5c7JRsZk
react-map-gl 7's <Map> ran mapboxgl.supported(props) before it constructed the map. With a props object that is the strict check (failIfMajorPerformanceCaveat). react-map-gl 8 dropped it. So a browser whose WebGL runs in software, or on a blocklisted GPU, drew a map where main keeps the curtain. A browser with no WebGL at all built half a map in #mapbox and logged two errors instead of one. The loader moves to map-lib.ts and refuses such a GPU with v7's own error, which react-map-gl logs from its mount effect. That effect can run after the import settles, so the cached promise carries a no-op catch. Without it the rejection would reach the host page's error handlers. map-lib.test.ts pins the loader: nothing is fetched on import, mapbox-gl is imported once per page, the check is the strict one, and a refusal is never an unhandled rejection. attribution.test.ts now also fails when Map.tsx calls the loader anywhere but the map element. Its old pattern let a module-scope prefetch through, and that brings back the map=false download. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVeNzer8ue5c7JRsZk
attribution.test.ts said importing Map.tsx would pull mapbox-gl into the node lane. Under react-map-gl 8 it does not. The spec reads the source because mapbox reads those literals only when it constructs a map, which needs WebGL. store.ts kept its warning on where the camera-settled flag lives, but its reason had become version history saying the reason was gone. It now says why the flag still belongs in the eager store: use-mapbox.ts imports react-map-gl, so an eager reader there would pull it into every embed. The CHANGELOG entry said the old build never ran Mapbox GL on a map=false embed. A dynamic import evaluates what it fetches, so it did run. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVeNzer8ue5c7JRsZk
#445 mapbox-gl's supported(true) asks WebGL with failIfMajorPerformanceCaveat, and Chromium 153 grants that on SwiftShader, so the check does not refuse software rendering in general. Reword the claims to a browser that reports a major performance caveat, such as a blocklisted GPU driver, and give the CHANGELOG entry its PR reference. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVeNzer8ue5c7JRsZk
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVeNzer8ue5c7JRsZk
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
sahajatlas-design | 031bc8b | Nov 19 2026, 11:17 PM |
sydevs-bot
enabled auto-merge
November 19, 2026 23:23
Ardnived
approved these changes
Nov 19, 2026
Contributor
Author
|
🤖 no session running Written by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
pushed a commit
that referenced
this pull request
Nov 19, 2026
…t-a11y CHANGELOG.md conflicted twice, both additive: main's #445 entry and this branch's two #432 entries landed in the same `### Changed` position, and their link definitions in the same place at the foot. Both sides kept, ordered by descending PR number like the entries around them. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjUuV5HDHKkDZZVCxFe
This was referenced Nov 19, 2026
sydevs-bot
pushed a commit
that referenced
this pull request
Nov 19, 2026
Three hunks, all kept from both sides. CHANGELOG keeps #445's `map=false` entry and this branch's 44 KiB entry, and both link definitions. Map.tsx keeps #445's `loadMapLib` import, `GeoFeature` and `hasPoint` alongside this branch's `mapWorldview`. The `MAP_WORLDVIEWS` table that `main` still holds in Map.tsx is dropped there and kept in `map-language.ts`, where this branch moved it and corrected the Japanese key from `jp` to `ja`. `Map.click.test.tsx` imported and mocked `react-map-gl`, which #445 removed as an entry point when it upgraded to react-map-gl 8. Both now name `react-map-gl/mapbox`, the specifier `Map.tsx` already uses. Lean gate green on the merged tree, with the build and `pnpm size`: lint, typecheck, 180 spec files (2271 passed, 1 skipped). The eager payload is unchanged at 290.6 / 291.7 / 3.3 KiB shipped. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjUujhd78iBhzSNLwcL
This was referenced Nov 19, 2026
sydevs-bot
pushed a commit
that referenced
this pull request
Nov 20, 2026
Three resolutions: - `src/views/shared.tsx` — keep both. #435's `role="search"` landmark on the wrapper, and this branch's controlled `value`/`onChange` on `MapSearch`, which is what stops half-typed text reaching `?q`. - `scripts/check-bundle-size.mjs` — both sides raised the embed budget to 338 from 336, so the figure stands and both history entries stay. Re-measured on the merge: standalone 335.5, embed 336.6, so 337.0 and 337.8 shipped, inside 338 with 0.2 KiB spare on the embed. - The five specs mocking `react-map-gl` now mock `react-map-gl/mapbox`. #445 upgraded the library to 8, which publishes no root entry, so every one of them died at import. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjX8sHLcAAW89cXoi6P
This was referenced Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This upgrades react-map-gl from 7.1.9 to 8.1.3, the current
lateston npm, and imports it throughreact-map-gl/mapbox. mapbox-gl stays at 3.35.0. The map behaves the same as on main, with one intended difference: amap=falseembed no longer downloads Mapbox GL. There is a CHANGELOG entry for that. The eager payload does not grow.What changed and why it matters
react-map-gl/mapbox. Views still reach it only throughFullInterface, and layer paint and layout stay inlayers.ts. Type changes v8 brought:GeoJSONSourcenow comes from mapbox-gl's own types.properties: {}.SymbolLayerProps, because v8'sLayerPropsalso admits aslotlayer, which takes no zoom range.language={locale}. This is now a typed prop, so a misspelt prop name failstsc. Before, it rode in a spread that escaped the excess-property check.loadMapLibinMapbox/map-lib.ts).<Map>'s mount effect, after the whole interface commits. On a local production build that was 442–457 ms later than v7. With the loader, the download starts 0–9 ms after the interface chunk, the same as v7.map=falseembed no longer downloads and runs the ~510 KiB gz library. v7 did, through its module-scopeimport('mapbox-gl').<Map>ranmapboxgl.supported(props), which is the strictfailIfMajorPerformanceCaveatcheck, before it built a map. v8 dropped that check.catch: react-map-gl only listens from its mount effect, and without the catch the host page's error handlers would see an unhandled rejection.<Popup>only applies a newanchorwhenoffsetchanges with it. Each anchor already has its own offset, and a spec now pins that.docs/rules/mapbox.mddocuments the loader and the strict check.docs/embedding.mdis unchanged. The CHANGELOG [Unreleased] entry coversmap=false.Verification
Base. Rebased onto
origin/mainat 775dcea (chore(contracts): re-sync copied contracts from SahajCloud #439), which includes chore(contracts): re-sync copied contracts from SahajCloud #434, chore(deps): update @hookform/resolvers to 7 and schema-dts to 2 #436, chore(deps): upgrade Sentry SDK and Vite plugin to 11.15.0 #437 and chore(deps): tailwind-variants 4.0.2 on its lite runtime #438. The rebase applied with no conflicts,pnpm-lock.yamlincluded.pnpm install --frozen-lockfilepasses at the tip, andpnpm install --lockfile-onlyleaves the lockfile unchanged..claude/skills/pr-prep/check.sh --full: passes on the rebased head. That covers lint, typecheck, the unit lane (177 files, 2134 tests), build (assert:css, assert:maps, assert:classic) and size.pnpm ladle:build: passes, with no source maps across 168 files.pnpm check:wrangler: both Worker configs dry-run OK.Size, eager graphs (gzip, measured / shipped / budget): identical to a build of
origin/mainat 775dcea. Standalone 333.5 / 334.7 / 336 KiB, embed 334.6 / 335.8 / 336, loader 2.8 / 3.3 / 3.6.Size, lazy map graph (gzip, zlib default level, FullInterface + shared + responsive chunks): 83.10 → 83.07 KiB against
origin/mainat 775dcea. The shared chunk goes 70.98 → 70.95, FullInterface stays at 11.47, and the mapbox-gl chunk stays at 512.08 KiB.Specs, each watched failing against the defect it guards:
mapLib={loadMapLib()}is on the map element.language={locale}.map-lib.test.ts:supported()in place ofsupported(true));attribution.test.ts: Map.tsx calls the loader only from the map element and never imports mapbox-gl itself. It failed against a module-scope prefetch and against a direct import.Browser, production build (placeholder token, Mapbox hosts stubbed, Chromium/SwiftShader):
#mapbox, the curtain stays, and one "Map is not supported by this browser" error is logged. Screenshots are pixel-identical to main's.map=false: mapbox-gl is never requested. Main requests it.Browser, Ladle dev server: the map renders, and the strict check also works through Vite's dev interop.
Browser, A/B against main (two independent passes, Ladle and production builds): identical results for:
On a map embed, the mapbox-gl request starts as early as on main (interleaved medians 295 vs 301 ms).
Not done / not verified
onMoveEndreporting sea-level zoom, could differ from v7.review:embedhost pages;Follow-ups for the maintainer
refuseUnsupportedand record it in the CHANGELOG. That was left out of this upgrade on purpose.origin/main,pnpm-lock.yamlchanges only here: react-map-gl 7.1.9 → 8.1.3,@vis.gl/react-mapboxand@vis.gl/react-maplibre8.1.3 added, and the deprecated@types/mapbox-gl3.5.0 stub removed. Ifmainmoves again before merge, rebase and re-runpnpm installrather than merging the lockfile by hand.CHANGELOG.mdandsrc/components/organisms/Mapbox/Map.tsx; chore: pay down audited tech debt across deps, data, bundle and CI #442 also edits the map (cluster expansion through the current padding,react-hooks/exhaustive-deps). Whichever lands second rebases and re-runs the gate.@vis.gl/react-mapboxdeclares its react peer as>=16.3, so it does not block the React 19 upgrade.@vis.gl/*packages (MIT). The maplibre wrapper is installed but not bundled..claude/. No edit there was needed.Interaction with the browser lane PR (#444)
The browser lane pins a known defect: on
main, amap=falseembed still downloads the 1.9 MB mapbox-gl chunk, and scenario d asserts that it does. This upgrade fixes the defect, because it starts that download only on the map's first render. I merged both branches in a scratch worktree and ran the lane. Scenario d fails with its own message ("the defect is fixed: asserttoEqual([])here"). The other 8 scenarios pass, and so do this branch's own specs.Whichever of the two lands second must flip the assertion in
tests/browser/embed.spec.ts("still fetches the mapbox-gl chunk, a known defect" → "never fetches the mapbox-gl chunk",expect(chunks).toEqual([])after waiting onrendered()). It must also rewritedocs/testing.md§ "A known defect, pinned". With that edit the lane passed 9 of 9, and that describe block passed 20 of 20 under--repeat-each 10.If a future Chromium starts flagging SwiftShader as a major performance caveat, the lane's full-map scenario goes red from this branch's strict check, not from a lane regression.
Generated by Claude Code