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
7a547d40fe
commit
993e6ba7d5
1 changed files with 5 additions and 2 deletions
|
|
@ -43,8 +43,11 @@ def recompute_dirty(db: Session, pl: Playlist) -> None:
|
|||
(and Watch later) are never dirty; a missing baseline counts as dirty (unknown YT state)."""
|
||||
if not pl.yt_playlist_id:
|
||||
pl.dirty = False
|
||||
else:
|
||||
pl.dirty = pl.synced_fingerprint != current_fingerprint(db, pl)
|
||||
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)
|
||||
|
||||
|
||||
def _ensure_videos(db: Session, yt: YouTubeClient, video_ids: list[str]) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue