Fix Playlist song list updating
When updating the song list in a playlist, we get a list of additions and removals (in the form of table indexes) to do. We then need to do the removals first to avoid invalidating the table indexes. The previous code did the additions first, causing exceptions and bogus songs left in the UI.
This commit is contained in:
@@ -148,13 +148,13 @@ def diff_song_store(store_to_edit: Any, new_store: Iterable[Any]):
|
||||
idx, field = _parse_diff_location(edit_location)
|
||||
store_to_edit[int(idx)][int(field)] = diff["new_value"]
|
||||
|
||||
for _, value in added.items():
|
||||
store_to_edit.append(value)
|
||||
|
||||
for remove_location, _ in reversed(list(removed.items())):
|
||||
remove_at = int(_parse_diff_location(remove_location)[0])
|
||||
del store_to_edit[remove_at]
|
||||
|
||||
for _, value in added.items():
|
||||
store_to_edit.append(value)
|
||||
|
||||
|
||||
def diff_model_store(store_to_edit: Any, new_store: Iterable[Any]):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user