Skip to content

fix: preserve wallet context when clicking token on map (#1795)#1818

Open
DukeDeSouth wants to merge 3 commits intoGreenstand:mainfrom
DukeDeSouth:fix/issue-1795-wallet-context-lost
Open

fix: preserve wallet context when clicking token on map (#1795)#1818
DukeDeSouth wants to merge 3 commits intoGreenstand:mainfrom
DukeDeSouth:fix/issue-1795-wallet-context-lost

Conversation

@DukeDeSouth
Copy link

@DukeDeSouth DukeDeSouth commented Feb 10, 2026

Summary

Fixes #1795 — When viewing a wallet page and clicking a token on the map, the wallet filter was lost, causing all tokens to display instead of only the wallet's tokens.

Root cause: getContext() in pathResolver.js returned {name: undefined} for Next.js rewritten URLs (e.g. /tokens/idfromquery), causing the token page's useEffect to call map.setFilters({}) which cleared all wallet filters.

Fix:

  • pathResolver.js: Add null safety checks for regex match groups, fix regex to handle URLs without query strings, remove unreachable dead code
  • [tokenid].js: Use router.query.walletId (forwarded by Next.js rewrite from source pattern) as fallback for wallet context detection

Changes

File What Changed
src/models/pathResolver.js getContext() — null safety, regex fix, dead code removal
src/pages/tokens/[tokenid].js Fallback wallet detection via router.query.walletId

Test plan

  • Open wallet page on mobile
  • Click a token on the map
  • Verify only wallet's tokens remain visible (not all tokens)
  • Verify direct token links (/tokens/uuid) still work correctly
  • Verify organization/planter context navigation is unaffected

Made with M7 Cursor

DukeDeSouth and others added 3 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]>
)

When viewing a wallet page and clicking a token on the map, the wallet
filter was lost, causing all tokens to display instead of only the
wallet's tokens.

Root cause: `getContext()` in pathResolver.js returned `{name: undefined}`
for rewritten URLs (e.g. /tokens/idfromquery), causing the token page's
useEffect to call `map.setFilters({})` which cleared all wallet filters.

Fix:
- pathResolver.js: Add null safety checks for regex matches, fix regex
  to allow URLs without query strings, remove unreachable dead code
- [tokenid].js: Use `router.query.walletId` (forwarded by Next.js
  rewrite) as fallback for wallet context detection

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.

When clicking the token on the map, we lost the context of the wallet.

1 participant