feat: shareable URL for legend filter state (#531)#534
Conversation
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>
There was a problem hiding this comment.
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.
| 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; | ||
| } |
There was a problem hiding this comment.
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 }
Summary
?poi=and?tab=URL featuresURL Parameters
types?types=trail,historicboundaries?boundaries=123,456layers?layers=trails,riversCloses #531
Test plan
/?types=trail,historicshows only those POI types/?poi=stanford-hostel&types=trailcomposes correctly/works as normal (no params, default state)🤖 Generated with Claude Code