Skip to content

Fix (Waypoints): clear placeholder results on panel close (#365)#399

Open
AaravJalan wants to merge 6 commits intovalhalla:masterfrom
AaravJalan:fix/365-waypoint-repopulated-panel-reopen
Open

Fix (Waypoints): clear placeholder results on panel close (#365)#399
AaravJalan wants to merge 6 commits intovalhalla:masterfrom
AaravJalan:fix/365-waypoint-repopulated-panel-reopen

Conversation

@AaravJalan
Copy link
Copy Markdown

🛠️ Fixes Issue

Closes #365

When the directions panel was closed and reopened, waypoints that were in a loading/placeholder state (coordinate pinned on map, reverse geocode still in flight, or just completed) would re-render with stale data — making it appear as if a waypoint had been populated when the user hadn't finished setting one.

👨‍💻 Changes proposed

src/stores/directions-store.ts

  • Added clearPlaceholderWaypoints action to DirectionsActions interface
  • Implemented the action: iterates waypoints and clears any that contain only placeholder geocode results (those with empty title), resetting both geocodeResults and userInput to empty

src/components/route-planner.tsx

  • Call clearPlaceholderWaypoints() before toggleDirections() on sheet close, so placeholder state is always cleaned up when the panel is dismissed

src/components/directions/waypoints/waypoint-item.tsx

  • Look up waypoint by id instead of index to prevent stale index references from causing wrong data to render after array mutations

Type of Change

  • Bug fix

@github-actions
Copy link
Copy Markdown

Preview is ready! 🚀 You can view it here: https://valhalla-app-tests.gis-ops.com/399

@AaravJalan
Copy link
Copy Markdown
Author

GSOC Contribution

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.

[Bug] Waypoint populated on reopening the left side panel

1 participant