Fix Fetch Feed Automatically never fetching feeds of profiles other than the first one viewed#9360
Open
VictorVow wants to merge 1 commit into
Open
Fix Fetch Feed Automatically never fetching feeds of profiles other than the first one viewed#9360VictorVow wants to merge 1 commit into
Fetch Feed Automatically never fetching feeds of profiles other than the first one viewed#9360VictorVow wants to merge 1 commit into
Conversation
Member
|
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Pull Request Type
Related issue
Closes #6089
Description
The
Fetch Feed Automaticallysetting is described as fetching the subscription feed "on startup and when a new window is opened". Since #5743 (first shipped in v0.22.0, which matches the "Last Known Working Version: v0.21.0" in the linked issue), the flag tracking whether the first automatic fetch has already run is a single boolean per window. The consequence: only the profile you view first ever gets an automatic fetch. When you switch to another profile, the flag is already consumed, so that profile silently shows whatever is in the persistent disk cache (which can be days old) and its feed is never automatically fetched at all during that session.The issue was closed with the reasoning that showing cached results is intended, but I believe that misses what's actually going wrong. This is not about wanting a re-fetch on every profile switch - the problem is that for every profile except the first one, the automatic fetch promised by the setting never happens, not even once. If a profile's feed is never fetched automatically, then
Fetch Feed Automaticallysimply isn't doing what its name and tooltip promise for that profile, and it's a regression from v0.21.0 where each profile got one automatic fetch per session.This PR scopes the "first auto-fetch has run" tracking per profile (a
Setof profile ids per tab type, instead of a boolean). Each profile now receives exactly one automatic remote fetch per session, the first time its feed is viewed. It deliberately does not re-fetch on every switch: returning to an already-fetched profile still shows the session cache, so the caching behaviour is preserved and there are no additional network requests compared to v0.21.0.The one-time-fetch check was also moved above the cache-presence check in
loadVideosFromCacheSometimes/loadPostsFromCacheSometimes, mirroring what #5743 did for the new-window path - otherwise the persistent disk cache would again take priority over the first automatic fetch.Screenshots
N/A - no visual changes.
Testing
Create two profiles (A and B) subscribed to different channels.
Enable Settings > Subscription Settings >
Fetch Feed Automatically.Restart FreeTube with profile A active and open the Subscriptions page: the feed is fetched from remote as before.
Switch to profile B:
Without this PR: the page shows the stale feed from the disk cache and no fetch happens; B's feed is never fetched automatically for the rest of the session.
With this PR: B's feed is fetched from remote once.
Switch back to profile A, then to B again: both load instantly from the session cache - no re-fetching on subsequent switches.
Repeat on the Shorts, Live and Posts tabs; each tab tracks its first fetch per profile independently.