fix: install MapLibre transform compat on the headless entry - #2088
Conversation
map-controller already installs the MapLibre 6 map.transform shim so @deck.gl/mapbox can read transform.height. @geolibre/map/headless skipped that, so COG/raster overlays throw every frame and draw nothing. Install the same shim on headless module load and re-export it.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. Important Approval pendingCodeRabbit has no unresolved comments, but it has not reviewed the latest commit. Use the checkbox below to review the latest commit. CodeRabbit will approve the changes if it finds no blocking issues.
📝 WalkthroughWalkthroughThe headless map entry point now installs map transform compatibility during module initialization and re-exports ChangesMap transform compatibility
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to This PR enables the existing MapLibre compatibility shim for the headless entry and re-exports it for callers that construct maps separately. No actionable merge-blocking risk remains beyond normal checks and review. Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR ensures the MapLibre v6 map.transform compatibility shim is installed when consumers import the @geolibre/map/headless entrypoint, preventing deck.gl / raster overlays from failing in apps that don’t use the full desktop map controller.
Changes:
- Import and run
installMapTransformCompat()at module load in the headless entry. - Re-export
installMapTransformCompatso external apps can call it explicitly when needed.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| import { installMapTransformCompat } from "./map-transform-compat"; | ||
|
|
||
| installMapTransformCompat(); |
There was a problem hiding this comment.
Minor/low-confidence: the underlying installMapTransformCompat behavior is already covered by tests/map-transform-compat.test.ts, but nothing currently regression-tests that @geolibre/map/headless actually wires it up at import time (the exact bug this PR fixes). A one-line addition to tests/headless-layer-sync.test.ts — importing the module and asserting MapLibreMap.prototype has a transform getter (or that installMapTransformCompat() now returns false since it's already installed) — would catch a future accidental removal of this side-effect call.
🔍 Cloudflare PR preview
|
Code reviewBugs: None found. The change simply calls the existing, well-tested Security: None found. No user input, no new external dependency, no secrets involved. Performance: None found. Quality: Low confidence — no regression test exercises the new wiring itself (only the underlying CLAUDE.md: No violations. This isn't a Overall: a minimal, correct, low-risk fix that follows the exact precedent already established in |
🔍 GitHub Pages PR preview
Note GitHub Pages built this preview successfully, but its serving edge returned HTTP 403 when checked. The links may still be propagating. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| @@ -10,6 +10,12 @@ | |||
| import type { GeoLibreLayer } from "@geolibre/core"; | |||
There was a problem hiding this comment.
Minor style nit: importing the symbol under an alias (line 9) just to call it, and separately re-exporting it from the same module (line 10), is a bit more indirection than needed — a single import used for both the call and the export would read the same with one less binding:
import { installMapTransformCompat } from "./map-transform-compat";
export { installMapTransformCompat };Purely stylistic; the code as written is correct. Confidence: low.
Code reviewBugs: None found. The fix correctly mirrors the already-tested Security: None found — no new input handling, no injection surface. Performance: None found. Module-load-time side effect is a one-time, cheap prototype-property definition; no per-frame cost beyond what already existed for the non-headless path. Quality:
CLAUDE.md: No violations. Overall: a small, well-scoped, correct fix consistent with the codebase's existing pattern for this shim. |
giswqs
left a comment
There was a problem hiding this comment.
LGTM. Thank you for your contribution.
Summary
installMapTransformCompat()already runs frommap-controller.tsfor the desktop app.@geolibre/map/headlessdid not call it.After MapLibre 6,
map.transformmoved tomap._camera.transform.@deck.gl/mapboxstill readsmap.transform.heighton every frame. Independent apps that only import the headless entry therefore throwCannot read properties of undefined (reading 'height')and COG /maplibre-gl-rasteroverlays draw nothing.This installs the existing shim when the headless module loads, and re-exports it for apps that construct
Mapfirst.Test plan
import { createLayerSync } from "@geolibre/map/headless"thennew Map(...)—map.transform.heightis definedmaplibre-gl-raster— overlay draws, no per-frameheighterrorMap#transformalready exists)Summary by CodeRabbit