Repository navigation
DF-1571: Fix issue with IM datasets when multiple maps on the same page - #485
Conversation
…e dataset plugin initialization
- Updated @defra/interactive-map from 0.0.33-alpha to ^0.0.56-alpha in package.json. - Changed import for createDrawPlugin from draw-ml to draw in geospatial-map.js and map.test.js. - Added workerPath configuration for maplibre-gl worker in map.js. - Updated map creation logic to include workerPath in createMap function. - Added ignoreWarnings for maplibre-gl in webpack.config.js to suppress critical dependency warnings.
Scullyon
left a comment
There was a problem hiding this comment.
Looks good to me, though I've left some comments including a package version to look into.
| const { | ||
| assetPath = '/assets', | ||
| apiPath = '/form/api', | ||
| workerPath = '/assets/interactive-map/maplibre-gl-worker.mjs', |
There was a problem hiding this comment.
Is this correct? What if assetPath is provided with the value files, but workerPath is undefined in config?
There was a problem hiding this comment.
In that case workerPath would default to /assets/interactive-map/maplibre-gl-worker.mjs
| @@ -197,11 +203,15 @@ export function initMaps(config = {}) { | |||
| } | |||
|
|
|||
| locations.forEach((location, index) => { | |||
There was a problem hiding this comment.
Just my 2 cents: locations seems a little ambiguous when talking about maps. Could be locations within the same map (eg points). Would locationQuestions or locationFields be a better name?
There was a problem hiding this comment.
locations here means LatLong, OSGR and EastingNorthing. These pre-date the geospatial question so probably would benefit from a rename - maybe one for tech debt.
| "@defra/interactive-map": "^0.0.56-alpha", | ||
| "@elastic/ecs-pino-format": "^1.5.0", | ||
| "@hapi/boom": "^10.0.1", | ||
| "@hapi/bourne": "^3.0.0", |
There was a problem hiding this comment.
Below: "maplibre-gl": "^5.24.0" may need updating to v6+ to avoid conflict with the the interactive-maps package which is on version 6.14.0
There was a problem hiding this comment.
Removed maplibre-gl as it is now bundled with IM
|



Proposed change
When multiple maps are on the same page and datasets are configured (SSSI or country boundary) then the latter maps also get initialised with the same datasets as those above it when they shouldn't be.
This PR currently contains half the fix but we need to wait for an update to IM to make datasets not work globally (which Dan L is aware of and fixing)
Jira ticket: https://eaflood.atlassian.net/browse/DF-1571
Type of change
Checklist
README.mdanddocs/*(where appropriate, e.g. new features).npm run test).npm run lint).npm run format).