Latent gap (found during PR #151 / issue #150)
Fixing #150 established that BoatMarker.tsx now re-adds its sources/layers on styledata after a style reload. Verifying the fix surfaced that the pattern it was told to mirror is itself one-shot: AisLayer.tsx's whenStyleReady uses once('load') and never re-adds after a mid-session map.setStyle(...). RouteLayer.tsx and DataLayers.tsx follow the same add-once idiom.
So after any future style reload, the AIS traffic layer, the route layers, and the data overlays (depth, seamarks, harbors) would all silently vanish until remount — same failure class as #150, three more sites.
Latent today: no code path calls map.setStyle mid-session. This is future-proofing for whenever one appears (e.g. a basemap style switch or theme-driven style swap).
Fix sketch
Extract the styledata-re-add pattern that PR #151 added to BoatMarker into ONE shared helper (e.g. lib/useStyleReadyLayers or a plain helper in MapView), and apply it to AisLayer, RouteLayer, and DataLayers — idempotent setup, latest-value refs, both listeners removed on unmount. Don't hand-copy the pattern three times.
Acceptance
After a programmatic map.setStyle() round-trip in each component's test (BoatMarker's simulateStyleReload fake from PR #151 is the reusable model), all sources/layers are present again; existing tests stay green; no behavior change outside the reload path.
Refs #150, PR #151 (premise correction in its body).
Latent gap (found during PR #151 / issue #150)
Fixing #150 established that
BoatMarker.tsxnow re-adds its sources/layers onstyledataafter a style reload. Verifying the fix surfaced that the pattern it was told to mirror is itself one-shot:AisLayer.tsx'swhenStyleReadyusesonce('load')and never re-adds after a mid-sessionmap.setStyle(...).RouteLayer.tsxandDataLayers.tsxfollow the same add-once idiom.So after any future style reload, the AIS traffic layer, the route layers, and the data overlays (depth, seamarks, harbors) would all silently vanish until remount — same failure class as #150, three more sites.
Latent today: no code path calls
map.setStylemid-session. This is future-proofing for whenever one appears (e.g. a basemap style switch or theme-driven style swap).Fix sketch
Extract the
styledata-re-add pattern that PR #151 added to BoatMarker into ONE shared helper (e.g.lib/useStyleReadyLayersor a plain helper inMapView), and apply it toAisLayer,RouteLayer, andDataLayers— idempotent setup, latest-value refs, both listeners removed on unmount. Don't hand-copy the pattern three times.Acceptance
After a programmatic
map.setStyle()round-trip in each component's test (BoatMarker'ssimulateStyleReloadfake from PR #151 is the reusable model), all sources/layers are present again; existing tests stay green; no behavior change outside the reload path.Refs #150, PR #151 (premise correction in its body).