Skip to content

fix(tv): keep the For You list selection, scroll, and a legible top bar - #156

Merged
RXWatcher merged 4 commits into
Silo-Server:mainfrom
RXWatcher:fix/tv-for-you-state
Jul 30, 2026
Merged

RXWatcher merged 4 commits into
Silo-Server:mainfrom
RXWatcher:fix/tv-for-you-state

Conversation

@RXWatcher

@RXWatcher RXWatcher commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Reported against v1.0.0+3 (83e23da1). That build already contains the recent TV focus batch, so these are live on current code rather than artifacts of an old release.

Four of the five reported issues; the other two are called out at the bottom as deliberately not addressed.

Watchlist and Favorites reverted to For You after opening an item

"Go to watchlist → open an item, then go back. It should take me back to the watchlist items but instead shows For You items." — same for Favorites.

savedListSelection was a plain remember. Opening an item disposes this screen's composition, so on the way back it re-initialised from entryRequest.selection — and top-level For You entry carries selection = null. So returning from a Watchlist item didn't merely forget the list, it actively reselected the recommendations feed. That's why it lands on For You rather than on an empty or default list.

lastAppliedEntrySequence had to move with it. Left as remember it resets to 0, and applyForYouEntryRequest then treats the unchanged entry request as new and re-applies its selection — reintroducing the identical jump even once the selection itself is saved. Fixing one without the other looks correct and isn't.

Both are now rememberSaveable.

Scroll position lost returning to the feed

The recommendations LazyColumn created its list state inside the when branch that renders content. A refresh on return briefly flips that branch to loading/empty and back, discarding the state with it. Hoisted above the branch so it survives.

The top bar was unreadable over For You

"the top bar (with Movies, Shows etc) is impossible to read. It's sticky but there's no background color... This is different behavior from Home, Movie → Recommended etc."

TvTopMenuBar deliberately has no background band of its own, and says why:

"No background band of its own: the SHELL draws a fixed top scrim behind the bar, so the focus dim below only affects the labels — content stays legibly scrimmed even while the bar is dimmed (QA 2026-07-08)."

The shell drew no such scrim. Its own comment two lines above the bar reads "content remains visible behind the transparent bar" — the two had drifted into contradicting each other, and the bar lost. With nothing behind it the labels sat directly on whatever scrolled underneath; on For You that's a poster row.

Restored in the shell as a gradient rather than a solid band, which satisfies both statements: content stays visible behind the bar, it just stops competing with the labels. Being in the shell it fixes every route, not only For You.

Deliberately not addressed

  • Jerky scrolling on For You. Not diagnosed. The list already carries key and contentType, so the usual suspects are ruled out and I'd want to look at image loading during scroll before guessing.
  • "Can't scroll the For You sections anymore" after returning. This looks like focus restoration rather than scroll state — on a D-pad, focus is what drives scrolling, and no focus means no movement. That belongs with TvRecommendationsFocusBridge and wants its own change.

Testing

./gradlew test green; both apps assemble. No tests added: per the repo guidelines these are UI changes, and the state-restoration behaviour needs an instrumented test rather than a unit test to be meaningful.

Note for CI: ServerSetupPersistenceTest and two :android-shared tests have been flaking today independently of any change — verified by re-running on clean main.

Summary by CodeRabbit

  • New Features
    • Added a subtle top gradient behind the TV menu bar to improve label visibility while keeping content visible.
  • Bug Fixes
    • Preserved recommendation feed scroll position when loading or empty states appear.
    • Maintained selection and navigation state when the recommendations screen is recreated.

Reported against v1.0.0+3 (83e23da), which already contains the recent TV
focus batch — these are live on current code, not stale-release artifacts.

**Watchlist and Favorites reverted to For You after opening an item.**
`savedListSelection` was a plain `remember`, so opening an item disposed the
composition and the value re-initialised from `entryRequest.selection` on the
way back. Top-level For You entry carries `selection = null`, so returning
from a Watchlist item did not merely forget the list — it actively reselected
the recommendations feed.

`lastAppliedEntrySequence` had to move with it. Left as `remember` it resets
to 0, which makes the entry-request effect treat the unchanged request as new
and re-apply its selection — reintroducing the same jump even once the
selection itself is saved. Both are now `rememberSaveable`.

**Scroll position was lost returning to the feed.** The recommendations
`LazyColumn` created its list state inside the `when` branch, so a refresh
that briefly flipped to loading/empty and back discarded it. Hoisted above
the branch.

**The top bar was unreadable over For You.** `TvTopMenuBar` deliberately has
no background band of its own and documents that "the SHELL draws a fixed top
scrim behind the bar" (QA 2026-07-08) — but the shell drew none, so the
labels sat directly on whatever scrolled underneath. On For You that is a
poster row. Restored as a gradient rather than a solid band, which satisfies
both that contract and the shell's own intent that content stay visible
behind the bar. This fixes every route, not just For You.

Not addressed: the jerky scrolling on For You, and "cannot scroll the
sections" after returning. The latter looks like focus restoration rather
than scroll state (on a D-pad, no focus means no scrolling) and belongs with
TvRecommendationsFocusBridge; both want their own change.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@RXWatcher, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 37 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2912d761-4966-42d1-b11b-9ba2e1b9131d

📥 Commits

Reviewing files that changed from the base of the PR and between 38d7c10 and 7cffbb9.

📒 Files selected for processing (2)
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/recommendations/TvRecommendationsScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/shell/TvMainShell.kt
📝 Walkthrough

Walkthrough

The recommendations screen now persists selection, entry sequence, and feed scroll state. The TV shell adds a top-aligned gradient scrim behind the menu bar.

Changes

Recommendations state persistence

Layer / File(s) Summary
Persist recommendations UI state
androidTvApp/.../recommendations/TvRecommendationsScreen.kt
Selection and entry-sequence state use rememberSaveable, while a remembered LazyListState is applied to the recommendations feed.

TV menu scrim

Layer / File(s) Summary
Add top menu gradient scrim
androidTvApp/.../ui/shell/TvMainShell.kt
A full-width vertical gradient fades from an opaque background color to transparent across the menu content inset.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: quick104

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main TV UI fixes: preserving selection and scroll state and improving top-bar readability.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Completes the second half of the report: "I can't scroll the For You sections
anymore" after opening an item and coming back.

The shell already has a detail-return path — a flag set when opening, a
resume claim on the content group, and a restorer fallback pointing at the
launch card — but every part of it was Home-only, and For You was wired to
the raw onOpenItemDetail. Nothing claimed content focus on the way back, so
focus settled wherever Compose's default search landed, and the D-pad no
longer drove the rows the viewer was just in.

Two flags now, deliberately: `restoreContentAfterDetail` means a return is
pending for ANY root and gates the resume claim; `restoreHomeContentAfterDetail`
additionally means it was the Home feed, which is the only root that attaches
homeDetailReturnCardFocusRequester to its launch card. Using that requester
as the restorer fallback for a root that never attached it would aim the
restorer at a detached node, so Home's behaviour is left byte-identical and
For You opts into the claim alone.

The screen's own once-per-entry focus grab had to stop fighting it. Its
guards were plain `remember`, so a detail return reset them, re-fired the
effect and slammed focus onto the Watchlist pill while the feed sat scrolled
where the viewer left it — the exact anti-pattern TvMainShell warns about:
"fired LaunchedEffects in each screen that imperatively re-focused index 0 —
defeating the restorer". Saved, the grab stays genuinely once-per-entry.

Jerky scrolling is NOT addressed. The usual causes are ruled out — TvMediaRow
carries key and contentType, hoists its row state, and memoises its item
mapping on remember(items, showProgress, style, cardLayout) — so what remains
(image decode during scroll, focus-driven recomposition, the absence of the
skyline feed's settled-focus prefetch policy on this plain LazyColumn) needs
a device profile rather than a guess.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/shell/TvMainShell.kt`:
- Around line 1154-1176: Condition the top scrim Box in TvMainShell to render
only when TvTopMenuBar is visible, using the same menu-suppression condition
that hides it on TvMainRoute.Settings. Keep the existing gradient, sizing, and
alignment unchanged for routes where the menu remains visible.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b23218d9-90c0-4ac6-9a0a-f9a4257693de

📥 Commits

Reviewing files that changed from the base of the PR and between ad3524b and 38d7c10.

📒 Files selected for processing (2)
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/recommendations/TvRecommendationsScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/shell/TvMainShell.kt

@RXWatcher

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@RXWatcher
RXWatcher merged commit 349b347 into Silo-Server:main Jul 30, 2026
2 checks 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.

1 participant