Uploaded image for project: 'MusicBrainz Server'
  1. MusicBrainz Server
  2. MBS-10898

"part of" Works disappear when changing order of parts while editing a Work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Normal Normal
    • None
    • None
    • Editing interface
    • None

      Follow-up of MBS-9649

      How to reproduce:

      On this example https://musicbrainz.org/work/056c2add-7a68-473f-8651-7f37e79b10e0, work parts are numbered 2 to 8 (instead of 1 to 7). Probably there was a part 1 that was merged/removed at one moment.

      When editing the Work, if I click on the "move entity up" arrow on the second part (number 3) it gets shifted and all parts are renumbered 1 to 7. If I click again on the second part (number 2) the first part disappears from the editor (I don't think the relation gets removed though). Same behavior if I continue.

      Debugging in knockout

      Looking at the JS code, ko.observableArray doesn't pass the 'moved' parameter the second time on the created/deleted changes, because it cannot match the entity that was moved before/after. Not sure why.

      Fix in MBS

      In the relationship-editor/.../field.js _moveEntity function we renumber all parts by calling linkOrder(1) ... linkOrder( n ) after swapping the two parts, without taking into account how the parts were numbered before the operation. Which is fine 99.99% of the time when parts are in successive numbers starting at 1.

       

      I will link to a patch that replaces the linkOrder() loop to make sure we keep the existing numbers and just swap the numbers of the two parts impacted by the "move entity up/down" button.

      I can confirm on my local instance that this fixes the bug. Still, I would understand if the bug gets rejected since the conditions for the bug to appear are to have a weird numbering, and it seems not delete relations, just confuse knockout.

       

       

            loujin loujin
            loujin loujin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package