Skip to content

feat: shareable URL for legend filter state (#531)#534

Merged
fatherlinux merged 2 commits into
masterfrom
feature/531-shareable-legend-filters
Jun 25, 2026
Merged

feat: shareable URL for legend filter state (#531)#534
fatherlinux merged 2 commits into
masterfrom
feature/531-shareable-legend-filters

Conversation

@fatherlinux

Copy link
Copy Markdown
Member

Summary

  • Legend filter state (POI types, boundaries, map layers) is now encoded in URL query parameters
  • Users can copy the URL and share it — recipients see the same legend filters applied
  • URL updates in real-time as legend items are toggled (no page reload)
  • When filters match defaults, parameters are omitted for clean URLs
  • Composes with existing ?poi= and ?tab= URL features

URL Parameters

Parameter Example Purpose
types ?types=trail,historic Show only listed POI types
boundaries ?boundaries=123,456 Show only listed boundary IDs
layers ?layers=trails,rivers Toggle trail/river/water-taxi overlays

Closes #531

Test plan

  • /?types=trail,historic shows only those POI types
  • Toggling legend items updates URL in address bar
  • Copy URL → new tab → same filter state
  • /?poi=stanford-hostel&types=trail composes correctly
  • Clean / works as normal (no params, default state)
  • Verified in browser on localhost:8081

🤖 Generated with Claude Code

fatherlinux and others added 2 commits June 24, 2026 23:30
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
POI type selections, boundary toggles, and layer visibility (trails,
rivers, water taxis) are now reflected in URL query parameters. Users
can copy the URL and share it — recipients see the same legend state.

Parameters: ?types=trail,historic  ?boundaries=123,456  ?layers=trails,rivers

When all filters match the defaults, the parameters are omitted for
clean URLs. Composes with existing ?poi= and ?tab= params.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fatherlinux fatherlinux merged commit 8fca706 into master Jun 25, 2026
2 of 3 checks passed
@fatherlinux fatherlinux deleted the feature/531-shareable-legend-filters branch June 25, 2026 16:56

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements shareable legend filters by parsing 'types', 'boundaries', and 'layers' query parameters from the URL on load to override default filter states, and syncing subsequent user toggles back to the URL. A critical bug was identified in App.jsx where map layers are unintentionally hidden when loading a URL that only filters POI types due to incorrect initialization of 'urlLayersRef.current'.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread frontend/src/App.jsx
Comment on lines +760 to +764
const layersParam = params.get('layers');
if (typesParam || layersParam) {
const layers = layersParam ? new Set(layersParam.split(',').map(l => l.trim()).filter(Boolean)) : new Set();
urlLayersRef.current = layers;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

There is a bug here where urlLayersRef.current is initialized to an empty Set if typesParam is present but layersParam is absent (due to the if (typesParam || layersParam) check). This causes all map layers (trails, rivers, water-taxis) to be hidden by default when loading a URL that only filters POI types (e.g., /?types=trail).\n\nInstead, we should only initialize urlLayersRef.current if layersParam is explicitly provided in the URL query parameters.

    const layersParam = params.get('layers');\n    if (layersParam !== null) {\n      urlLayersRef.current = new Set(layersParam.split(',').map(l => l.trim()).filter(Boolean));\n    }

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.

Shareable URL for legend filter state (POI types and boundaries)

1 participant