feat: fix waypoint duplication on panel reopen & improve delete button enablement#377
Closed
ritgit24 wants to merge 5 commits intovalhalla:masterfrom
Closed
feat: fix waypoint duplication on panel reopen & improve delete button enablement#377ritgit24 wants to merge 5 commits intovalhalla:masterfrom
ritgit24 wants to merge 5 commits intovalhalla:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates waypoint handling for directions permalink loading and adjusts waypoint removal behavior/tests.
Changes:
- Expand directions waypoint list during permalink reverse-geocoding when indices exceed current waypoint count.
- Change “remove waypoint” button disablement logic to depend on geocode selection state.
- Update unit test mocks to include selected geocode results.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/hooks/use-directions-queries.ts |
Adjusts permalink reverse-geocode flow to add missing waypoints before setting placeholders. |
src/components/isochrones/waypoints.spec.tsx |
Updates mocked geocodeResults in isochrones waypoint tests. |
src/components/directions/waypoints/waypoint-item.tsx |
Changes remove-button disabled logic for directions waypoints. |
src/components/directions/waypoints/waypoint-item.spec.tsx |
Updates waypoint test mock data to include selected flag. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+154
to
+162
| const currentLen = useDirectionsStore.getState().waypoints.length; | ||
| if (index >= currentLen) { | ||
| const toAdd = index - currentLen + 1; | ||
| for (let i = 0; i < toAdd; i++) | ||
| { | ||
| addEmptyWaypointToEnd(); | ||
| } | ||
| } | ||
| } |
Comment on lines
+119
to
+120
| disabled={ | ||
| !geocodeResults?.some((r) => r.selected)} |
Comment on lines
+33
to
+35
| { selected: true, sourcelnglat: [13.4, 52.5] } , | ||
| { selected: true, sourcelnglat: [20.6, 39.1] } , | ||
| { selected: true, sourcelnglat: [29.7, 41.2] } , |
| userInput: 'Berlin', | ||
| geocodeResults: [ | ||
| { title: 'Berlin, Germany', addressindex: 0, lngLat: [13.4, 52.5] }, | ||
| { title: 'Berlin, Germany', addressindex: 0, lngLat: [13.4, 52.5], selected: true }, |
Member
|
closing due to not adhering to our gsoc guidelines |
Author
Sorry for any mistakes I may have made. I did spend a lot of time on this PR, carefully testing and verifying potential issues, and I also took clear note of the guidelines while preparing it. I would be very grateful if you could specify which guideline I didn’t adhere to . |
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.
Closes #270 & #365
🛠️ Fixes Issue
Both the issues were potentially causing bad UX.
👨💻 Changes proposed
use-directions-queries.ts: Ensuring waypoint slots exist before writing placeholders (prevents duplicated waypoints on sidebar reopen) by making permalink reverse‑geocode idempotent.waypoint-item.tsx: Only enable per‑waypoint Delete when that waypoint’sgeocodeResultscontains a selected result.Test Updates
waypoint-item.spec.tsx,waypoints.spec.tsx: To align mocks/expectations with new behavior for the UI , and testing the geocode result handling📷 Screenshots