fix: clear tree selection on /top navigation and prevent stale markers (#1329)#1817
Open
DukeDeSouth wants to merge 2 commits intoGreenstand:mainfrom
Open
fix: clear tree selection on /top navigation and prevent stale markers (#1329)#1817DukeDeSouth wants to merge 2 commits intoGreenstand:mainfrom
DukeDeSouth wants to merge 2 commits intoGreenstand:mainfrom
Conversation
…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]>
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.
Description
Fixes the highlighted tree icon staying on the map after clicking "Home". Two root causes found:
/toppage never calledclearSelection()— onlysetFilters({})was called in the reload effect, so navigating back to/topleft stale selected markers visible on the map.Detail pages had async
useEffectwithout cleanup —[treeid].js,[tokenid].js, and[captureid].jsran async operations (setFilters,focusTree) before callingselectTree(). If the user navigated away mid-flight, the pendingselectTree()would fire afterclearSelection()fromHome.js, re-adding the marker.Changes
src/pages/top.js— addawait mapContext.map.clearSelection()beforesetFilters({})in reload effectsrc/pages/trees/[treeid].js— addcancelledflag +if (cancelled) returnguards before eachselectTree()call + cleanup returnsrc/pages/tokens/[tokenid].js— same cancelled-flag patternsrc/pages/v2/captures/[captureid].js— same cancelled-flag patternSteps to reproduce (before fix)
/topAfter 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