youtube icon indicating copy to clipboard operation
youtube copied to clipboard

fix: reverse playlist persists across video navigation (fixes #3759, #3818, #3883)

Open jiangyj545 opened this issue 5 months ago • 2 comments

(running playlistReverseUpdate() twice with 1.5s delay)

Fix for #3759, #3818, #3883 — Reverse playlist reverts on video navigation

### Problem When "Reverse Playlist" is active and the user navigates to the next video in the playlist, YouTube's SPA navigation triggers `yt-page-data-updated`. The extension calls `playlistReverseUpdate()`, but at this point `ytd_watch.data` may not be populated yet, so the function returns early without applying the reverse. The playlist then renders in its original order.

Solution

Add a delayed retry (1.5s) in playlistReverse(). After the initial playlistReverseUpdate() call, a setTimeout fires once more to catch the case where the first attempt returned early because playlist data wasn't ready.

This is minimal and safe:

  • Only retries when playlistReversed is still true
  • Does not add an interval or loop — just one additional attempt
  • The existing isCurrentlyReversed === shouldBeReversed guard in playlistReverseUpdate() prevents double-reversing if the first call succeeded

Changes

File Change
playlist.js Added 1.5s delayed retry of playlistReverseUpdate() in playlistReverse()

Testing

  • 66/69 unit tests pass (3 pre-existing failures unrelated to this change)
  • JS-only change, no CSS or HTML modifications

jiangyj545 avatar Jun 09 '26 04:06 jiangyj545

hi! @suryaprakash0010 #3766

ImprovedTube2 avatar Jun 10 '26 01:06 ImprovedTube2

Try the latest release first? #3643 should've already fixed this

Hyperspeed1313 avatar Jun 10 '26 01:06 Hyperspeed1313