Skip to content

fix: clear tree selection on /top navigation and prevent stale markers (#1329)#1817

Open
DukeDeSouth wants to merge 2 commits intoGreenstand:mainfrom
DukeDeSouth:fix/issue-1329-tree-icon-stays-on-map
Open

fix: clear tree selection on /top navigation and prevent stale markers (#1329)#1817
DukeDeSouth wants to merge 2 commits intoGreenstand:mainfrom
DukeDeSouth:fix/issue-1329-tree-icon-stays-on-map

Conversation

@DukeDeSouth
Copy link

Description

Fixes the highlighted tree icon staying on the map after clicking "Home". Two root causes found:

  1. /top page never called clearSelection() — only setFilters({}) was called in the reload effect, so navigating back to /top left stale selected markers visible on the map.

  2. Detail pages had async useEffect without cleanup[treeid].js, [tokenid].js, and [captureid].js ran async operations (setFilters, focusTree) before calling selectTree(). If the user navigated away mid-flight, the pending selectTree() would fire after clearSelection() from Home.js, re-adding the marker.

Changes

  • src/pages/top.js — add await mapContext.map.clearSelection() before setFilters({}) in reload effect
  • src/pages/trees/[treeid].js — add cancelled flag + if (cancelled) return guards before each selectTree() call + cleanup return
  • src/pages/tokens/[tokenid].js — same cancelled-flag pattern
  • src/pages/v2/captures/[captureid].js — same cancelled-flag pattern

Steps to reproduce (before fix)

  1. Open /top
  2. Click a tree on the map
  3. Click another tree on the map (switch)
  4. Click "Home" breadcrumb
  5. Bug: highlighted tree icon stays on the map

After fix

Step 5 → highlighted tree icon is removed, map returns to clean state.

Stats

4 files changed, 15 insertions, 18 deletions. No new dependencies.

Closes #1329

Made with Cursor

DukeDeSouth and others added 2 commits February 9, 2026 11:52
…nd#1713)

marked.parse() was called without the `breaks` option, so single
newline characters in wallet/planter/organization about text were
rendered as spaces instead of line breaks.

Adding `{ breaks: true }` makes marked treat single newlines as <br>
tags (GFM-style), which correctly renders line breaks in the about
and mission sections across all three entity pages.

Co-authored-by: Cursor <[email protected]>
Greenstand#1329)

When clicking trees on the map and then navigating to "Home", the
highlighted tree icon wrongly stayed on the map. Two root causes:

1. /top page only called setFilters({}) but never clearSelection(),
   so navigating back to /top left stale selected markers visible.

2. Detail pages (trees, tokens, captures) ran async operations
   (setFilters, focusTree) before selectTree() without a cancellation
   guard — if the user navigated away mid-flight, the pending
   selectTree() would fire after clearSelection(), re-adding the marker.

Changes:
- Add clearSelection() to top.js reload effect
- Add cancelled flag + cleanup return to useEffect in [treeid].js,
  [tokenid].js, and [captureid].js to prevent race conditions

Closes Greenstand#1329

Co-authored-by: Cursor <[email protected]>
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.

The tree icon wrongly stays on the map

1 participant