Skip to content

Seamark/harbor layers can insert above AIS vessels for a whole session — asset-fetch vs AisLayer setup race, amplified by #149's forced overlap #160

Description

@DocGerd

Bug (confirmed by 2/2 adversarial verifiers, session-7 verification sweep)

AisLayer's documented invariant — AIS renders ABOVE the depth/seamark overlays (AisLayer.tsx:64-66) — is not enforced: both AisLayer and DataLayers resolve their insert anchor (beforeId = ROUTE_STACK_BOTTOM_LAYER, or append) at their own setup time, so whichever setup runs LAST lands higher. AisLayer sets up at Live-tab mount as soon as the style loads; DataLayers additionally waits for the multi-MB routing-assets fetch (DataLayers.tsx:257). If assets resolve after AisLayer's setup, sc-seamarks (and harbor labels) insert directly below the route anchor — ABOVE sc-ais-vessels — and are never reordered afterwards.

#149 makes it user-visible: at z≥12 icon-overlap: 'always' draws EVERY seamark, now on top of the green vessel arrows, and below z12 the topmost seamark layer wins symbol collision against AIS name labels — in exactly the dense-AtoN fairways #149 targeted, approaching traffic is visually buried under static seamarks for the whole session.

Trigger: returning user (key + seamarks toggle persisted ON) on a cleared cache / new device over slow LTE taps the Live tab while the asset fetch is in flight.

Fix directions to evaluate

  1. Deterministic anchoring: when the AIS layers exist, DataLayers inserts its overlay layers with beforeId = <first sc-ais layer> (and vice versa AisLayer keeps anchoring to the route stack) — order becomes timing-independent.
  2. AisLayer re-asserts its position (moveLayer) after setup AND on styledata re-adds, as a belt-and-braces.
  3. A small central layer-order helper if (1)/(2) get hairy — but prefer the minimal anchor fix.

Acceptance

Regardless of asset-fetch timing vs Live-mount order (test both orders with the shared fakeMaplibre), sc-ais-* layers sit above seamarks/harbors and below the route stack, matching the documented order; AIS name labels win collision over seamark icons as before #149 at <z12; existing DataLayers/AisLayer reload tests green; datalayers e2e canvas baselines still settle.

Refs #25 (AisLayer invariant comment), #7/#149 (seamarks), #153/#156 (styledata re-add interplay).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions