MBS-7597: Replacing recording-work relationship in relationship editor fails
mwiencek
Branch: mwiencek/musicbrainz-server:mbs-7597
Branch: metabrainz/musicbrainz-server:beta
Merged
Merged pull request
Merge remote-tracking branch 'bitmap/mbs-7597' into beta
This was difficult to reproduce because it depends on the timing of the request for work relationships. One problem was that code would try to access the relationships of a work before that property existed. Another problem was that code would try to access the editData property of a relationship before that property existed.
The first problem is solved by initializing a relationships array for every core entity instance right in its init method, instead of waiting until it's needed (problem being that so much code depends on it being defined, so it's easier to always have it).
The second problem is fixed by adding a slight delay before showing a relationship on the page, to give time for the editData property to become defined. This is a hack, and is better solved by https://bitbucket.org/metabrainz/musicbrainz-server/pull-request/971/mbs-7538-make-it-possible-to-edit-url which simplifies the class hierarchy and makes the delay unnecessary. So I'll adjust the code depending on which is merged first.