Skip to content

Crud waypoints - #23

Open
Michael-R-Dickinson wants to merge 19 commits into
masterfrom
crud-waypoints
Open

Crud waypoints#23
Michael-R-Dickinson wants to merge 19 commits into
masterfrom
crud-waypoints

Conversation

@Michael-R-Dickinson

Copy link
Copy Markdown
Contributor

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

Resolves # (issue)

Type of change

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

  • Test A
  • Test B

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. This is simply a reminder of what we are going to look for before merging your code.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@Michael-R-Dickinson
Michael-R-Dickinson marked this pull request as ready for review January 17, 2025 03:58

@jimgeng jimgeng left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just needs a small addition for now. Though we might need to write some new logic to handle adding to certain routes as well since that's breaking the whole route CRUD system right now. Can also consider removing the rest of the references to the params and commands.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The delete all waypoints logic should be updated as well in this file. (The one in the modal)

Comment thread src/utils/useWaypoints.ts
Comment on lines +41 to +52
const editWaypoint = async (waypoint: Waypoint) => {
// Update needs to be instant so that changes update on the map when we drag
// Before the server responds
// So if stuff goes wrong, we roll the changes back
const waypointSnapshot = [...waypoints];
try {
setWaypoints(waypoints?.map((w) => (w.id === waypoint.id ? waypoint : w)) || []);
await updateWaypointQuery(waypoint);
} catch {
setWaypoints(waypointSnapshot);
}
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In the future can consider updating this behaviour to show a error popup if it fails instead of silently failing (with the only way to tell being that the changes are reverted).

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.

2 participants