Skip to content

Click-highlight layer is permanently detached after any layer-config change #155

Description

@ckrew

Click-highlight layer is permanently detached after any layer-config change

Where: reactapp/components/visualizations/Map.js (~lines 699-704, inside onMapClick)

if (highlightLayer.current) {
  highlightLayer.current.getSource().clear();
} else {
  highlightLayer.current = createHighlightLayer();
  map.addLayer(highlightLayer.current);
}

Mechanics: the layer-reconciliation effect in reactapp/components/map/Map.js (the layersToKeep/layersToRemove sweep, ~lines 281-290 and 540-542) removes any OL layer whose name is not in the configured layer list. highlightLayer is an imperative overlay, not a configured layer, so any layer-config rebuild (variable-input substitution changing a layer, adding/removing a layer, editing layer properties) detaches it from the map. The ref is never nulled, so the else branch never runs again — every subsequent click clears/adds features into a detached layer that renders nowhere.

User-visible effect: click-selection highlighting silently and permanently stops working after the first layer-config change that follows a click. (The marker layer does not have this bug — it is recreated and re-added on every click.)

Repro: click a feature (highlight appears) → change any variable input that rebuilds a layer, or edit a layer in the dashboard editor → click a feature again → no highlight.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions