Repository navigation
Remove mapbox.js and old raster map implementation - #2473
Conversation
36e5d5b to
af5a613
Compare
There was a problem hiding this comment.
Pull request overview
Removes the legacy mapbox.js/raster-map path and associated backend API/config, consolidating map rendering on MapLibre and refactoring the or-map MapWidget accordingly.
Changes:
- Drops
mapbox.js+@types/mapboxdependencies and related bundler/knip configuration. - Removes the
/api/.../map/js(getSettingsJs) endpoint and theMapType/mapTypeconfiguration. - Refactors
ui/component/or-map/src/mapwidget.tsto a single MapLibre-based implementation.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Removes mapbox.js transitive packages (Leaflet, mustache, etc.). |
| ui/util/webpack.util.js | Updates CSS handling regex to drop mapbox-specific matching. |
| ui/knip.jsonc | Removes @types/mapbox from ignored dependencies. |
| ui/component/or-map/src/util/index.ts | Removes Leaflet bounds helper used by the old raster implementation. |
| ui/component/or-map/src/style.ts | Removes mapbox/leaflet-specific selectors tied to the deprecated implementation. |
| ui/component/or-map/src/mapwidget.ts | Removes raster/mapbox.js code paths; refactors to a single MapLibre map implementation. |
| ui/component/or-map/src/index.ts | Removes type: MapType usage and updates MapWidget construction accordingly. |
| ui/component/or-map/rspack.config.js | Removes mapbox.js vendor/global binding configuration. |
| ui/component/or-map/package.json | Removes mapbox.js and @types/mapbox dependencies. |
| ui/component/or-map/README.md | Updates component description from Mapbox to MapLibre. |
| ui/component/core/src/index.ts | Removes manager.mapType accessor (no longer backed by config). |
| ui/app/storybook/rsbuild.config.ts | Updates CSS handling regex to drop mapbox-specific matching. |
| model/src/main/java/org/openremote/model/map/MapResource.java | Removes getSettingsJs endpoint and updates MapLibre naming in docs/operation summaries. |
| model/src/main/java/org/openremote/model/manager/MapType.java | Removes the MapType enum entirely. |
| model/src/main/java/org/openremote/model/manager/ManagerConfig.java | Removes mapType field from manager configuration model. |
| manager/src/main/java/org/openremote/manager/map/MapService.java | Removes getMapSettingsJs implementation. |
| manager/src/main/java/org/openremote/manager/map/MapResourceImpl.java | Removes getSettingsJs endpoint implementation. |
Comments suppressed due to low confidence (1)
ui/component/or-map/src/mapwidget.ts:15
maplibre-glis imported at module scope (runtime) and also dynamically imported inbuild()(await import('maplibre-gl')). The static import will pull the library into the initial bundle, which defeats the purpose of code-splitting and can lead to confusion about which module instance to use. Either remove the dynamic import and use the static import throughout, or convert the top-level import to type-only imports and use the dynamically imported module for runtime usage (including the geocoder).
import manager, { DefaultColor4 } from "@openremote/core";
import maplibregl, {
AddLayerObject,
IControl,
GeolocateControl,
LngLat,
LngLatLike,
Map as MapGL,
MapOptions,
MapMouseEvent,
Marker,
NavigationControl,
StyleSpecification,
GeoJSONSourceSpecification,
} from "maplibre-gl";
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 17 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (2)
manager/src/main/java/org/openremote/manager/map/MapService.java:387
mapSettingsJscache is still declared butgetMapSettingsJs()was removed, so this map is now unused and will never be cleared/populated meaningfully. Remove the unused field to avoid confusion and dead state.
/**
* Dynamically build MapLibre GL settings based on mapsettings.json
*/
public ObjectNode getMapSettings(String realm, URI host) {
String realmUriKey = realm + host.toString();
if (mapSettings.containsKey(realmUriKey)) {
return mapSettings.get(realmUriKey);
}
ui/component/or-map/src/mapwidget.ts:674
marker._elementis an internal/non-public property of MapLibre'sMarkerand may change across versions (and may not be in typings). Use the publicmarker.getElement()API and cast/check that element againstOrClusterMarkerinstead.
for (const id in this._markersOnScreen) {
const marker = newMarkers[id];
if (!marker
|| marker._element instanceof OrClusterMarker && !marker._element.hasTypes(Object.keys(this._assetTypeColors))
) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
db51029 to
41986eb
Compare
Description
This PR removes the
mapbox.jsdependency and references to the old raster map implementation as we don't intend on using or supporting it anymore. You can still use raster maps through MapLibre.Some of the code in the
or-mapcomponent namely inmapwidget.tshas also been refactored, so it's easier to maintain.Changelog
mapbox.jsdependency@types/mapboxdev dependency/api/manager/map/getSettingsJsendpointMapTypeand any references to Raster mapsmapwidget.tscodeChecklist
2. Tests are written and all tests pass