open-tacos
open-tacos copied to clipboard
Bulk adding new routes - ordering of routes gets scrambled and requires reordering
Steps to Reproduce
- Add several routes to test area via bulk add
- Check sorting of routes - it'll be all over the place
- To get routes in order you have to manually sort climbs again when it would be best for them to stay in the order you added them in
Screenshots
Expected Behavior
Routes should be added to a crag in the order they were written in the bulk submit
Current Behavior
Routes get scrambled in seemingly random order?
Browser & version
<--- Example: Firefox 102.7.0esr --> Google Chrome
Operating system
<--- Example: MacOS 13.2.1 --> Windows
Tackling this one, seems like a good first issue for graphql changes.
Quick context off my initial read:
The order of climbs within in area is handled by left_right_index, which is what the sort climbs feature updates, and what this app uses for display. By default, all climbs have a null sort index, hence it's basically undefined behavior and seemingly random.
IMO it's best resolved in the model/graphql layer directly -- for any operation that sends an array, we should assume that's the intended order.
Tangentially related detail is deciding order of incoming new climbs vs existing climbs. Right now adding a climb puts it first in the list. Again, that's not really intended behavior, we can go either way:
- append -- new climbs after existing climbs (my preference but it breaks status quo so figured I'd mention it) OR
- prepend -- new climbs before existing climbs