Repository navigation
fix(web): cap the season episode grid at four scrolling rows - #811
Conversation
A full season pushed the cast, crew and everything below it off the page: the grid rendered every episode, so a 194-episode season was thousands of pixels of uninterrupted cards. The compact hero had the matching problem in the other direction — `lg:h-[42vh]` is a fixed height, so a long season summary overflowed above its own clipped backdrop and took the breadcrumb and title with it. The grid now shows four rows and scrolls the rest, and the compact hero grows downward instead of overflowing. `useGridRowCap` measures where the row after the cap begins rather than deriving a height. These cards pair a fixed-ratio still with a variable block of text, so there is no row height a stylesheet can name, and the column count changes at every breakpoint — a `calc()` would have to encode both and would drift the moment either changed. The measurement is written straight to the element: it is a layout value applied to the node it was read from, so a render round trip would buy nothing and would make every resize frame cascade. Two columns is now the narrowest layout rather than one. At a single column the capped region measured 2.33 viewports on a 375px screen — a nested scroll region taller than the screen containing it, which is worse than the problem being fixed. Two columns brings that to 1.06 while doubling the episodes on screen. Closes #804. Ports the season-layout half of #805 by @blurbery, rebuilt against the data router now on main. The navigation and app-wide presentation changes from that branch are deliberately not included here. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Warning Review limit reachedNext included review available in 56 minutes. View limit detailsLimit details: You’ve used the included review currently available. Your 100 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9807c5f63
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| // Content can change without the box changing — swapping to a season with a | ||
| // different episode count while the grid stays capped at the same height. | ||
| useLayoutEffect(applyCap, [applyCap, itemCount]); |
There was a problem hiding this comment.
Re-measure when grid content changes
Once the grid is capped, its observed border box remains fixed, so ResizeObserver does not fire when child heights change. Because this effect depends only on itemCount, an asynchronous web-font swap or an episode metadata refresh that keeps the same number of episodes can change row offsets without recalculating maxHeight, leaving the fourth row clipped or part of the fifth row visible. Observe the row content/children or include a content revision that changes whenever card layout can change.
Useful? React with 👍 / 👎.
Problem
Related issue: #804
A full season pushed the cast, crew and everything below it off the page. The grid
rendered every episode, so a 194-episode season (One Piece: Wano Country, the worst
case in my library) was a 9,575px wall of cards before anything else on the page.
The compact hero had the matching problem in the other direction:
lg:h-[42vh]is afixed height, so a long season summary overflowed above its own clipped backdrop and
took the breadcrumb and title with it.
Approach
The grid shows four rows and scrolls the rest; the compact hero grows downward
instead of overflowing.
Why the cap is measured rather than calculated. These cards pair a fixed-ratio
still with a variable block of text, so there is no row height a stylesheet can name,
and the column count changes at every breakpoint — a
calc()would have to encodeboth and would drift the moment either changed.
useGridRowCapreads the offset ofthe first item on the row after the cap. That is correct for any combination of
column count, card content and breakpoint, and it needs no constant kept in sync with
the CSS.
The measurement is written straight to the element rather than held in state: it is a
layout value applied to the node it was read from, so a render round trip would buy
nothing and would make every resize frame cascade.
Two columns is now the narrowest layout, replacing the single-column base. At one
column the capped region measured 2.33 viewports on a 375px screen — a nested
scroll region taller than the screen containing it, which is worse than the problem
being fixed. Two columns brings that to 1.06 while doubling the episodes on screen.
Validation
Measured live against the 194-episode season at every breakpoint. The cap lands flush
with the last visible row in each case (
row5.offsetTop − row1.offsetTop − rowGap),and the section stops scrolling entirely when a season is shorter than the cap:
Also confirmed a short season (8 episodes, 2 rows) gets no
max-heightand noscrollport at all, and that a live resize re-measures rather than keeping a stale cap.
pnpm run build— passedpnpm exec vitest run— 2613 passedpnpm run lint— 0 errors (165 pre-existing warnings, unchanged baseline)pnpm run format:check— passedNote
Screenshots to follow — I verified this against a live deployment but cannot attach
images from the CLI. The measurements above are the substantive evidence.
Risks
The episode section is now a nested scroll region, which is a pattern worth being
deliberate about. It stays under ~1.06 viewports at every breakpoint so the whole
region and its scrollbar are visible at once — that bound is why the single-column
layout was dropped. A
ResizeObserverre-measures on breakpoint changes; theregression test covers the case where the grid mounts after a loading skeleton, which
is where an earlier revision of this hook silently froze the cap at first layout.
Provenance
Ports the season-layout half of #805 by @blurbery, rebuilt against the data router now
on
main. That branch moved episodes into a horizontal carousel; this keeps the grid,which is what @Quick104 preferred on review. The navigation and app-wide presentation
changes from that branch are deliberately not included.
AI Disclosure
the grid over the carousel, chose the row cap and the two-column mobile base, and
reviewed the result against a live deployment.
then rebuilt from scratch against
main. Two bugs were found and fixed during liveverification rather than by reading the diff: the
ResizeObserverbound to a nullref while the loading skeleton was showing and never retried (the cap froze at first
layout and ignored every resize), and
tsc -bcaught an unchecked index access thattsc --noEmitpassed. Both are covered by tests.Checklist
🤖 Generated with Claude Code