Skip to content

fix: keep late-arriving features hidden when their layer is hidden - #125

Merged
ThomasHalwax merged 1 commit into
mainfrom
fix/hidden-layer-live-features
Oct 21, 2026
Merged

ThomasHalwax merged 1 commit into
mainfrom
fix/hidden-layer-live-features

Conversation

@ThomasHalwax

Copy link
Copy Markdown
Member

Problem

Hiding a layer writes a hidden+ marker for the layer key and for every feature present at that moment. Features created afterwards through store.import (NIDO WebSocket API, Matrix replication) carry no marker of their own. The visibility tracker only checked the feature's own key, so new features showed up on the map inside a hidden layer. Updates to existing features stayed hidden, which is why the effect is most visible with live sources that create new keys continuously (e.g. Sentinel tracks and units).

Fix

visibilityTracker now treats a feature as hidden when either its own key or its layer key is in the hidden set. The layer key is already part of the set, since Store.hide collects the layer id itself. Covers NIDO and replication alike; the SSE live data sources are separate OpenLayers layers and not affected by this code path.

Side effect, accepted on purpose: a single feature inside a hidden layer can no longer be shown separately while the layer stays hidden.

Test

New test/renderer/model/sources/visibilityTracker-test.js (4 cases): visible layer, feature arriving after the layer was hidden, layer hidden before the tracker started, other layers unaffected.

npx mocha test/renderer/model/sources/visibilityTracker-test.js   # 4 passing
npx eslint src/renderer/model/sources/visibilityTracker.js test/renderer/model/sources/visibilityTracker-test.js

Note: npm test as a whole fails on main already (test/shared/level/*, test/renderer/store/schema/Schema-test.js, test/main/legacy/*: missing modules / directory imports under Node 22). Unrelated to this change.

🤖 Generated with Claude Code

Hiding a layer marks the layer key and every feature present at that
moment with a hidden+ entry. Features created afterwards through
store.import (NIDO WebSocket API, Matrix replication) carry no marker,
and the visibility tracker only checked the feature's own key, so they
appeared on the map inside a hidden layer.

The tracker now also treats a feature as hidden when its layer key is
in the hidden set. Covered by a new visibilityTracker test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@ThomasHalwax
ThomasHalwax merged commit 7717643 into main Oct 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant