fix(playlists): dirty lagged one edit (flush before fingerprinting)
The session has autoflush off, so recompute_dirty's query read the last-committed state, not the current request's pending item/order edits — so the first reorder after a sync compared against itself and missed dirty, and only the next edit showed it. Flush pending changes before computing the current fingerprint. Verified: a swap now flips dirty immediately, and reverting to the original clears it.
This commit is contained in:
parent
871dad834a
commit
7b8f835226
1 changed files with 5 additions and 2 deletions
|
|
@ -43,7 +43,10 @@ def recompute_dirty(db: Session, pl: Playlist) -> None:
|
||||||
(and Watch later) are never dirty; a missing baseline counts as dirty (unknown YT state)."""
|
(and Watch later) are never dirty; a missing baseline counts as dirty (unknown YT state)."""
|
||||||
if not pl.yt_playlist_id:
|
if not pl.yt_playlist_id:
|
||||||
pl.dirty = False
|
pl.dirty = False
|
||||||
else:
|
return
|
||||||
|
# The session has autoflush off, so the caller's pending item/order/name edits aren't
|
||||||
|
# visible to current_fingerprint's query yet — flush first or dirty would lag one edit.
|
||||||
|
db.flush()
|
||||||
pl.dirty = pl.synced_fingerprint != current_fingerprint(db, pl)
|
pl.dirty = pl.synced_fingerprint != current_fingerprint(db, pl)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue