Skip to content

Render the continuous view from segment pages - #467

Merged
alex-rawlings-yyc merged 7 commits into
mainfrom
437-continuous-view-pages
Oct 20, 2026
Merged

alex-rawlings-yyc merged 7 commits into
mainfrom
437-continuous-view-pages

Conversation

@alex-rawlings-yyc

@alex-rawlings-yyc alex-rawlings-yyc commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Closes #437. Part of Phase 2 (#425).

Strip. The continuous strip renders from segment pages, through a run of segments of its own rather than the segment list's useSegmentWindow range, which culls by the list's vertical scroll. The run holds the segments under its mounted groups and its focus, plus a margin of words each side, as far as their pages have loaded. The strip asks for those pages and a few segments beyond, and while it fades out it asks for the pages around the focus it is moving to. A jump to a segment whose page has not loaded stays faded until it does, and the arrows disable at the last group held while the page beyond it loads. Groups keep their indexes as the run grows or trims at either end, so neither reads as a focus move. Chapters in verse labels are still qualified over the whole outline. The lookup maps the strip is handed (useBookIndexes) still cover the whole book, as the plan allows until #453.

Pages. SegmentPages.load takes a caller, and a new outline is published with the pages around each caller's latest range loaded. A boundary edit made in the strip therefore keeps the strip's segments loaded, not just the list's.

Phrase window. usePhraseWindow takes the index of the first group it may mount. It re-watches its sentinels when groups arrive past an edge it stopped at.

Re-anchor. A phrase whose tokens fall in more than one segment goes stale, as one that lost a token does, so the strip can group each segment on its own.

Verified.

  • In the app over CDP, on WEB, the strip matched main on opening Genesis, after a jump to unloaded 40:1, after scrolling it to both ends of Genesis, and after a merge and a phrase link made in it.
  • A 3,000-notch wheel scroll from 2:1 lands where main does, notch for notch, and no notch stalled at an unloaded edge.

This change is Reviewable

Summary by CodeRabbit

  • Improvements
    • Continuous reading now loads content around the displayed range independently, supporting navigation to unloaded chapters and either end of a book.
    • When jumping to content that hasn’t loaded yet, the view waits for it to become available before updating focus.
    • Loading earlier content preserves the displayed position.
    • Verse labels remain correct when displaying a portion of a book.
  • Bug Fixes
    • Improved continuous-view navigation and display behavior around page boundaries and phrase links.

@alex-rawlings-yyc alex-rawlings-yyc self-assigned this Oct 19, 2026
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d6db0a31-b5c8-4432-9407-cf3356f2942e
📝 Walkthrough

The continuous view now renders from its own segment-page range. Caller-specific page loading, bounded strip ranges, and absolute group indexes support rendering and navigation across loaded segments.

Changes: Continuous Strip

Layer / File(s) Summary
Caller-specific page loading
src/hooks/useSegmentPages.ts, src/components/SegmentListView.tsx, src/__tests__/hooks/useSegmentPages.test.ts, src/__tests__/components/Interlinearizer.test.tsx
Page loads now identify their caller. The hook retains each caller’s most recent range and requests pages around those ranges when the outline changes. The segment list passes the list caller ID.
Strip segment range selection
src/utils/strip-range.ts, src/hooks/useStripSegments.ts, src/__tests__/utils/strip-range.test.ts, src/__tests__/hooks/useStripSegments.test.ts
The new range utilities find word-margin targets and contiguous loaded runs. useStripSegments selects held segments around focus and mounted tokens, requests pages with a segment prefetch margin, and reports whether a token’s page is loaded.
Absolute group indexing and rendering
src/hooks/useStripGroups.ts, src/hooks/usePhraseWindow.ts, src/components/ContinuousView.tsx, src/components/Interlinearizer.tsx, src/utils/verse-superscripts.ts, src/__tests__/*, docs/data-layer-plan/plan.md
The strip builds numbered groups from loaded segments and bounds its render window to the available group indexes. ContinuousView receives segment pages, delays showing an external focus until its page loads, and uses whole-book verse labels. Tests cover loading, navigation, grouping, window bounds, and verse labels. The plan updates the Phase 2c completion checks.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant ContinuousView
  participant useStripSegments
  participant useSegmentPages
  participant useStripGroups
  ContinuousView->>useStripSegments: provide focus and mounted token refs
  useStripSegments->>useSegmentPages: request target pages
  useSegmentPages-->>useStripSegments: provide loaded pages
  useStripSegments-->>ContinuousView: provide held segments
  ContinuousView->>useStripGroups: build groups from held segments
  useStripGroups-->>ContinuousView: provide numbered groups
Loading

Suggested reviewers: imnasnainaec

Merge Risk: 🔵 Low · up to 1cf6d

Editing a phrase outside the strip’s loaded range can leave the strip focused elsewhere. This is a bounded interaction issue, but it should be fixed or accepted before merging.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the primary change: rendering the continuous view from segment pages.
Linked Issues check Passed Issue #437 requires the strip to render from segment pages and flatten its own segment range. ContinuousView receives SegmentPages, and useStripSegments computes and loads a strip-specific run w…
Out of Scope Changes check Passed The changes stay within #437. The plan edit documents the 2c requirement. The new hooks, page-loader changes, phrase-window changes, stable group indexing, verse-label handling, and related tests supp…
Docstring Coverage Passed Docstring coverage is 87.10% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 31 functions across 17 files. (1 skipped: 1…
Full details: Linked Issues check

Explanation

Issue #437 requires the strip to render from segment pages and flatten its own segment range. ContinuousView receives SegmentPages, and useStripSegments computes and loads a strip-specific run with prefetch margins. useStripGroups assigns stable absolute group indexes. useSegmentPages records ranges per caller and reloads both callers' ranges after an outline change. Added tests cover strip range loading, unloaded focus behavior, page boundaries, boundary edits, phrase windows, group indexing, and verse labels. These changes satisfy the coding requirements for #437.

Full details: Out of Scope Changes check

Explanation

The changes stay within #437. The plan edit documents the 2c requirement. The new hooks, page-loader changes, phrase-window changes, stable group indexing, verse-label handling, and related tests support the strip's independent range, loading, navigation, and editing behavior. No unrelated product behavior is established by the reviewed summary or inspected code.

Full details: Docstring Coverage

Explanation

Docstring coverage is 87.10% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 31 functions across 17 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

imnasnainaec

This comment was marked as resolved.

@imnasnainaec

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@alex-rawlings-yyc

Copy link
Copy Markdown
Contributor Author

No shared files with #468, and the branches merge cleanly. After a Scripture edit, though, the new outline loads pages around the opening verse only. The ranges the segment list and the strip last asked for are skipped, since their textVersion no longer matches. So both views can briefly show placeholders where the user had scrolled.

The fix is to drop the textVersion check on the last ranges for the same book, since an edit seldom moves segments far. It touches the lines this PR rewrites for per-caller ranges, so it fits here or right after.

A patch against this PR's head, with a test that fails without the fix:
Patch

Applied your patch as is, test included.

imnasnainaec

This comment was marked as resolved.

@imnasnainaec imnasnainaec 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.

@imnasnainaec reviewed 14 files and all commit messages, and resolved 6 discussions.
Reviewable status: 14 of 23 files reviewed, 2 unresolved discussions (waiting on alex-rawlings-yyc).

@alex-rawlings-yyc
alex-rawlings-yyc force-pushed the 437-continuous-view-pages branch from 1179276 to 25f09a4 Compare October 19, 2026 23:06
imnasnainaec

This comment was marked as resolved.

imnasnainaec

This comment was marked as resolved.

@imnasnainaec imnasnainaec 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.

@imnasnainaec reviewed 5 files and resolved 12 discussions.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on alex-rawlings-yyc).

@alex-rawlings-yyc
alex-rawlings-yyc merged commit 1fbd9db into main Oct 20, 2026
9 checks passed
@alex-rawlings-yyc
alex-rawlings-yyc deleted the 437-continuous-view-pages branch October 20, 2026 20:16
@imnasnainaec imnasnainaec changed the title Render the continuous view from segment pages (#437) Render the continuous view from segment pages Oct 20, 2026
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.

[2c] Render the continuous view from segment pages

2 participants