Clear POI overlay markers when all categories are unchecked - #1978
Open
vshcherb wants to merge 1 commit into
Open
Clear POI overlay markers when all categories are unchecked#1978vshcherb wants to merge 1 commit into
vshcherb wants to merge 1 commit into
Conversation
The POI layer effect tested `... || move || isTypeChange` before the empty-categories branch. `move` is a moveend timestamp that stays truthy after the first map move, so the first branch always won, and the branch that removes the layer when the category list became empty was never reached — the orange POI markers stayed on the map until a page reload. Check for empty categories first, then the zoom/move/type-change refresh. Add selenium test search/100-poi-overlay-disable.mjs, which enables a POI category, then unchecks it and waits for the markers to disappear. It fails on the old code (waitByRemoved times out) and passes with the fix. Fixes #1945 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1945 — after the POI Overlay is disabled in Configure Map, the orange POI icons stayed on the map until a manual page refresh.
Cause
PoiLayer's main effect started with:moveis themoveendtimestamp fromuseZoomMoveMapHandlersand is never reset, so it stays truthy after the first map move (which happens on load). The first branch therefore always won; inside itif (ctx.showPoiCategories.length > 0)was false, so nothing happened — and the branch that callsclearPoiList()when the category list becomes empty was never reached.Fix
Check the empty-categories case first, then the zoom/move/type-change refresh. The nested
ctx.showPoiCategories.length > 0check is now redundant and is dropped.Test
New selenium test
search/100-poi-overlay-disable.mjs: enables the Cafe and restaurant category, checks the markers appear, unchecks it, and waits for them to disappear. It fails onmain(waitByRemovedtimes out onse-poi-marker-background-#f8931d-circle) and passes with the fix.Verified locally against
localhost:3000(dev server proxied to test.osmand.net):search(11),map(2) andmenu(6) suites all pass.AI disclaimer
Produced with Claude Code (Opus 5).
Prompts used (summarised):
Decided by the agent, not requested explicitly:
PoiLayer's effect (checking the empty-category case first) rather than resetting themoveflag after each refresh; the redundant nestedlength > 0check was dropped as part of it.tests/selenium/src/tests/search/100-poi-overlay-disable.mjs), modelled on the existing91-poi-markers-test.mjs.search,mapandmenusuites as a regression check, and confirming the new test fails on the unfixed code before claiming it covers the bug.