Edge: resume on the same clip after switching tabs, creator pages load all clips from RedGifs #3

Open
girlyoulookthebest wants to merge 3 commits from girlyoulookthebest/goon:fix/edge-seen-and-creator into main
Contributor

wo fixes for Edge, plus a changelog entry. Three commits on top of 8491f38, plus a merge of current main (0de28b2) that resolves a changelog conflict. Fix 1 is app-only (JavaScript, can go out as OTA). Fix 2 needs the backend deployed; the app side of it is JavaScript as well. No native changes, no migrations, no new dependencies.

1. Coming back to Edge no longer replays clips you already watched (fd8aa5d, e77bd60)
Edge unmounts whenever you switch to another tab (it holds the video players). On the way back it started at seedKey 0 and clip 0, while the pages from the previous visit were still in the react-query cache (staleTime: Infinity, default 5 min gc). So within 5 minutes of leaving, Edge replayed everything already watched from the first clip; after that the cache was gone and the server sent new clips, which is why it only happened sometimes. The server's seen-tracking was fine: across 5 pages and a fresh deal, no clip id came back.
Edge now remembers its place between mounts (module-level seedKey, filter and index) and resumes on the clip you left while those pages are cached; the feed cache is kept 30 min. If the pages are gone, it gets a new deal from the server. The pager mounts only after the Edge prefs are loaded (prefsReady): the cached pages are available on the first render, one render before the prefs, and a pager mounted then started on page 0 and pulled Edge back to the first clip.
Touches: screens/SwipeScreen.tsx.

2. A creator's page loads their clips from RedGifs (fd8aa5d)
GET /clips?creator= only listed what ingest had happened to catch (hourly "latest" plus the niche backfill), often a small part of the account: one creator had 2 clips locally out of 225 on RedGifs, another has 11,222 on RedGifs. RedgifsClient.user_gifs existed but nothing called it.
The first page request for a creator now starts a background sync from /v2/users/<name>/search (newest first, up to 20 pages = 2,000 clips) and waits at most 4 s for the first page; the response says syncing: true while more is coming. A repeat visit after 6 h syncs again and stops at the first page with nothing new. Syncs run one at a time on a single worker thread (RedGifs rate limits per IP), with at most 8 waiting; state is in-process, which fits the single API replica. GOON_CLIPS_CREATOR_SYNC=false turns it off. The app polls every 3 s while syncing, but not while a clip is playing from the grid, since newer clips land above the current one and would shift the pager; items are de-duplicated by id because pages shift as clips arrive.
Touches: app/api/clips.py, app/scheduler/clips_ingest.py (sync_creator), app/connectors/clips/redgifs.py (user name is URL-encoded, PAGE_MAX), app/config.py, mobile/src/screens/ClipCreatorScreen.tsx, mobile/src/types.ts, new tests/test_creator_sync_20261126.py.

Changelog: one new entry, 2026-11-27b, with a line per fix, above Jan's 2026-11-27a (movie ratings), which is unchanged (c219b20, merge 76dddac).

Testing: Android 15 emulator against a local backend built from this branch, with about 4,200 real RedGifs clips imported. Fix 1: checked by hand (scroll, switch to Scenes, back to Edge: same clip) and through the app's own feed events and debug logs (left on clip 3, came back on clip 3, no page 0 reported). Fix 2: against the local API, a creator with 2 clips locally returned 100 after about 1 s with syncing: true, then all 225 a few seconds later; sync_creator run live against RedGifs fetched all 137 clips of another creator in 2 pages. Not tried on a physical phone, and fix 2 has not been tested in the app on the emulator yet.
12 new backend tests pass. The full suite has the same 3 failures as main here (they need STREAM_PROXY_SECRET), and ruff reports the same 11 existing warnings in the touched files. The app typecheck shows the same 7 errors as main, none new.

wo fixes for Edge, plus a changelog entry. Three commits on top of 8491f38, plus a merge of current main (0de28b2) that resolves a changelog conflict. Fix 1 is app-only (JavaScript, can go out as OTA). Fix 2 needs the backend deployed; the app side of it is JavaScript as well. No native changes, no migrations, no new dependencies. **1. Coming back to Edge no longer replays clips you already watched** (`fd8aa5d`, `e77bd60`) Edge unmounts whenever you switch to another tab (it holds the video players). On the way back it started at seedKey 0 and clip 0, while the pages from the previous visit were still in the react-query cache (`staleTime: Infinity`, default 5 min gc). So within 5 minutes of leaving, Edge replayed everything already watched from the first clip; after that the cache was gone and the server sent new clips, which is why it only happened sometimes. The server's seen-tracking was fine: across 5 pages and a fresh deal, no clip id came back. Edge now remembers its place between mounts (module-level `seedKey`, filter and index) and resumes on the clip you left while those pages are cached; the feed cache is kept 30 min. If the pages are gone, it gets a new deal from the server. The pager mounts only after the Edge prefs are loaded (`prefsReady`): the cached pages are available on the first render, one render before the prefs, and a pager mounted then started on page 0 and pulled Edge back to the first clip. Touches: `screens/SwipeScreen.tsx`. **2. A creator's page loads their clips from RedGifs** (`fd8aa5d`) `GET /clips?creator=` only listed what ingest had happened to catch (hourly "latest" plus the niche backfill), often a small part of the account: one creator had 2 clips locally out of 225 on RedGifs, another has 11,222 on RedGifs. `RedgifsClient.user_gifs` existed but nothing called it. The first page request for a creator now starts a background sync from `/v2/users/<name>/search` (newest first, up to 20 pages = 2,000 clips) and waits at most 4 s for the first page; the response says `syncing: true` while more is coming. A repeat visit after 6 h syncs again and stops at the first page with nothing new. Syncs run one at a time on a single worker thread (RedGifs rate limits per IP), with at most 8 waiting; state is in-process, which fits the single API replica. `GOON_CLIPS_CREATOR_SYNC=false` turns it off. The app polls every 3 s while `syncing`, but not while a clip is playing from the grid, since newer clips land above the current one and would shift the pager; items are de-duplicated by id because pages shift as clips arrive. Touches: `app/api/clips.py`, `app/scheduler/clips_ingest.py` (`sync_creator`), `app/connectors/clips/redgifs.py` (user name is URL-encoded, `PAGE_MAX`), `app/config.py`, `mobile/src/screens/ClipCreatorScreen.tsx`, `mobile/src/types.ts`, new `tests/test_creator_sync_20261126.py`. **Changelog:** one new entry, `2026-11-27b`, with a line per fix, above Jan's `2026-11-27a` (movie ratings), which is unchanged (`c219b20`, merge `76dddac`). **Testing:** Android 15 emulator against a local backend built from this branch, with about 4,200 real RedGifs clips imported. Fix 1: checked by hand (scroll, switch to Scenes, back to Edge: same clip) and through the app's own feed events and debug logs (left on clip 3, came back on clip 3, no page 0 reported). Fix 2: against the local API, a creator with 2 clips locally returned 100 after about 1 s with `syncing: true`, then all 225 a few seconds later; `sync_creator` run live against RedGifs fetched all 137 clips of another creator in 2 pages. Not tried on a physical phone, and fix 2 has not been tested in the app on the emulator yet. 12 new backend tests pass. The full suite has the same 3 failures as main here (they need `STREAM_PROXY_SECRET`), and ruff reports the same 11 existing warnings in the touched files. The app typecheck shows the same 7 errors as main, none new.
Edge odmontowuje sie przy wyjsciu do innej zakladki. Po powrocie startowal od klucza 0
i klipu 0, a strony z poprzedniej wizyty lezaly w cache react-query (staleTime Infinity),
wiec feed pokazywal od poczatku klipy juz obejrzane. Teraz wraca na klip, na ktorym user
wyszedl (cache feedu 30 min), a gdy stron juz nie ma, pobiera nowe od serwera.

Strona tworcy pokazywala tylko klipy z "najnowszych" i backfillu nisz, czesto ulamek
konta. Pierwsze wejscie (i ponowne po 6 h) sciaga klipy tworcy z RedGifs w tle
(/users/<name>/search, do 2000 najnowszych, jeden watek przez limit per IP), odpowiedz
czeka do 4 s na pierwsza strone, apka odpytuje co 3 s, dopoki syncing (nie w trakcie
ogladania). GOON_CLIPS_CREATOR_SYNC=false wylacza.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cache feedu jest dostepny od pierwszego renderu, a ustawienia Edge (prefsReady) render
pozniej. Pager montowal sie wiec z initialPage 0, zanim zapadla decyzja o powrocie, i po
wyborze strony 0 Edge wracal na pierwszy klip. Sprawdzone na emulatorze z lokalnym
backendem: wyjscie na klipie 3, powrot na klip 3, bez zgloszenia strony 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chore(mobile): changelog 2026-11-27a
Some checks are pending
Backend tests / test (pull_request) Blocked by required conditions
c219b20e31
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
girlyoulookthebest changed title from Edge: resume on the same clip after switching tabs, creator pages load all clips from RedGifs to WIP: Edge: resume on the same clip after switching tabs, creator pages load all clips from RedGifs 2026-11-27 17:00:02 +00:00
girlyoulookthebest changed title from WIP: Edge: resume on the same clip after switching tabs, creator pages load all clips from RedGifs to Edge: resume on the same clip after switching tabs, creator pages load all clips from RedGifs 2026-11-29 18:15:16 +00:00
Some checks are pending
Backend tests / test (pull_request) Blocked by required conditions
This pull request has changes conflicting with the target branch.
  • mobile/src/changelog.ts
Some workflows are waiting to be reviewed.
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u fix/edge-seen-and-creator:girlyoulookthebest-fix/edge-seen-and-creator
git switch girlyoulookthebest-fix/edge-seen-and-creator

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff girlyoulookthebest-fix/edge-seen-and-creator
git switch girlyoulookthebest-fix/edge-seen-and-creator
git rebase main
git switch main
git merge --ff-only girlyoulookthebest-fix/edge-seen-and-creator
git switch girlyoulookthebest-fix/edge-seen-and-creator
git rebase main
git switch main
git merge --no-ff girlyoulookthebest-fix/edge-seen-and-creator
git switch main
git merge --squash girlyoulookthebest-fix/edge-seen-and-creator
git switch main
git merge --ff-only girlyoulookthebest-fix/edge-seen-and-creator
git switch main
git merge girlyoulookthebest-fix/edge-seen-and-creator
git push origin main
Sign in to join this conversation.
No reviewers
jan
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
goon-foss/goon!3
No description provided.