Problem
src/map.ts uses a module-level mutable Map to store MapLibre map instances:
const store = new Map<string, maplibregl.Map>()
This breaks React's unidirectional data flow, makes testing difficult (no way to mock/reset between tests), and creates an implicit dependency that's hard to trace.
What needs to change
Consider replacing with:
- A React Context that provides the map instance(s), or
- Storing the map ref in Redux (as a non-serializable value), or
- Using
react-map-gl's built-in useMap() hook (from MapProvider) consistently throughout the codebase