We’re trying to upgrade from Ember Data beta.12 to Ember Data 1.13 and are running into an issue with our drag n drop implementation that reorders records within a
hasMany association. We don’t use the
SortableMixin, instead we use the records implicit position within the association.
Our problem is that the records in
canonicalState never change their position. So when a new activity is added after at least 1 activity has changed it’s position we end up with a set of records in the wrong order.
flushCanonical is called as part of
Relationship.addCanonicalRecord, it replaces records in the many relationship with their order before sorting. e.g.
// Original order "Activity 1" "Activity 2" // After drag n drop reordering "Activity 2" "Activity 1" // After adding a new activity "Activity 1" "Activity 2" "New Activity" // But it really should be "Activity 2" "Activity 1" "New Activity"
Is this something that should be supported by Ember Data or are we going about it the wrong way?