Skip to content

chore(release): prepare version 4.0.1 with analytics fixes, playlist updates, and storage optimizations - #82

Merged
EdinUser merged 4 commits into
mainfrom
fix/issues-with-playlist-and-stats
Nov 26, 2025
Merged

chore(release): prepare version 4.0.1 with analytics fixes, playlist updates, and storage optimizations#82
EdinUser merged 4 commits into
mainfrom
fix/issues-with-playlist-and-stats

Conversation

@EdinUser

Copy link
Copy Markdown
Owner
  • Fixed analytics summary cards by rebuilding persistent stats from hybrid storage for improved accuracy.
  • Improved playlist handling: robust detection, reliable history toggles, and better navigation detection.
  • Enhanced data hygiene with pruning of stats to last 7 days for a compact snapshot.
  • Removed outdated sync triggers and redundant code for cleaner storage management.
  • Updated manifest.json version to 4.0.1.

This pull request updates YT re:Watch to version 4.0.1, focusing on major reliability improvements for stats/analytics and playlist handling. The changes address issues with inconsistent analytics, enhance playlist detection and progress saving, and introduce better data hygiene for stored stats. There are also significant code enhancements for playlist navigation and video progress restoration, ensuring more accurate and responsive user experience.

Stats & Analytics Reliability Improvements

  • Persistent stats snapshot is now rebuilt from the full hybrid history (IndexedDB + localStorage), serving as the single source of truth for all analytics summary cards and charts. This fixes inconsistencies and ensures summary cards and charts (Total Watch Time, Videos Watched, Shorts Watched, etc.) reflect the complete history, not just the current page. [1] [2] [3] [4] [5]
  • Activity and Watch Time by Hour charts now use the same persisted daily/hourly stats snapshot, with local-day keys and 24 hourly buckets, for stable and full-history graphs. [1] [2] [3]

Playlist Handling Enhancements

  • Improved playlist detection and title extraction across YouTube layout variants using a broader selector set and retry-based saver. Playlist “pause history” toggles are now more reliable, preventing unwanted history entries for ignored playlists.
  • Enhanced playlist navigation detection in src/content.js with interval-based checks, mutation observers, and context-aware timing resets. This ensures correct progress restoration and prevents inherited timing issues when navigating between videos in a playlist. [1] [2] [3] [4] [5] [6] [7] [8]

Data Hygiene

  • Hybrid stats rebuilds now prune the daily stats map to the last 7 local days, keeping the snapshot compact and aligned with the UI display. [1] [2] [3]

Diagnostics & Logging

  • Improved logging for link and click interception, playlist navigation, and video initialization to aid debugging and ensure correct behavior during navigation and progress restoration. [1] [2] [3]

Version Bump

  • Updated extension manifest files for Chrome and Firefox to version 4.0.1. [1] [2]

…updates, and storage optimizations

- Fixed analytics summary cards by rebuilding persistent stats from hybrid storage for improved accuracy.
- Improved playlist handling: robust detection, reliable history toggles, and better navigation detection.
- Enhanced data hygiene with pruning of stats to last 7 days for a compact snapshot.
- Removed outdated sync triggers and redundant code for cleaner storage management.
- Updated `manifest.json` version to 4.0.1.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This release (v4.0.1) focuses on improving the reliability and accuracy of analytics by introducing a hybrid stats snapshot system and enhancing playlist navigation handling. The changes rebuild persistent stats from the complete hybrid storage (IndexedDB + localStorage) to serve as the single source of truth for all analytics displays, ensuring summary cards and charts reflect the full history rather than just the current page.

Key Changes:

  • Persistent stats snapshot now rebuilt from full hybrid history with one-time rebuild mechanism using stats_synced flag
  • Analytics charts (Activity, Watch Time by Hour) and summary cards use the persisted stats snapshot for accuracy across complete dataset
  • Enhanced playlist navigation detection with dedicated interval checks, timing resets, and mutation observers to prevent inherited timing issues

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/storage.js Added _rebuildStatsFromHybrid() method to rebuild stats snapshot from merged IndexedDB + localStorage with 7-day daily retention; removed outdated sync trigger code
src/popup.js Updated calculateAnalytics() to prefer persisted stats counters; enhanced chart rendering to use snapshot data; added analyticsAllVideos for full-history analytics
src/content.js Added handlePlaylistNavigation() function with timing reset logic; enhanced click/link interception logging; added 500ms playlist navigation check interval
tests/unit/storage.test.js Added comprehensive tests for stats rebuild, 7-day pruning, and incremental updates; added playlist ignore flag preservation test
tests/unit/popup.test.js Added test verifying export includes stats snapshot from ytStorage.getStats()
src/manifest.chrome.json Version bump to 4.0.1
src/manifest.firefox.json Version bump to 4.0.1
docs/technical.md Updated stats structure documentation to include stats_synced and lastFullRebuild fields
docs/index.md Updated analytics description to mention hybrid history rebuild and 7-day retention
docs/detailed_guide.md Updated export documentation to mention compact 7-day daily buckets
CHANGELOG.md Added v4.0.1 release notes documenting stats fixes, playlist improvements, and data hygiene

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment thread src/content.js Outdated
Comment thread tests/unit/storage.test.js Outdated
Comment thread src/popup.js Outdated
Comment thread src/content.js Outdated
…ng reliability

- Refined `timestampLoaded` property and dataset flag reset for better SPA navigation handling.
- Added conditional checks to prevent errors from null video objects.
- Improved analytics average duration calculation with `Number.isFinite` check.
- Enhanced unit test for hybrid storage, ensuring daily stats pruning validates key format and count.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment thread src/storage.js Outdated
Comment thread src/content.js Outdated
EdinUser and others added 2 commits November 26, 2025 18:06
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@EdinUser
EdinUser merged commit 9c13f9a into main Nov 26, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants