There are a number of ways to refer to a position in a List, which determines the behavior when the list has changed between when the reference is created and when it is used:
At the beginning/end of the list
Between two adjacent items
Two types of anchor behavior: anchor to the first, anchor to the second (only matters if one is moved or something is inserted between them)
A possible third: anchor to whichever has not been moved
Immediately after an item
Immediately before an item
At a specific fractional index
When adding an item in reference to another item, we usually want to fall back on a fractional index. That way, if the item it is in reference to is removed, we can fall back on the index.
For simplicity the right approach here is probably something like:
There are a number of ways to refer to a position in a
List
, which determines the behavior when the list has changed between when the reference is created and when it is used:When adding an item in reference to another item, we usually want to fall back on a fractional index. That way, if the item it is in reference to is removed, we can fall back on the index.
For simplicity the right approach here is probably something like:
This would accomplish the most common use cases, but not the more complex ones.