Conversation
- 閱讀頁底部新增「第 X 頁/共 Y 頁・Z%」顯示,比照網頁版 Toolbar 設計;全書頁數改用背景 隱藏渲染每個 linear 章節取得精確頁數(scanAllChapterPages),取代原本字元數概算的作法 - 修正目錄章節跳轉失敗(No Section Found):目錄 href 與 spine item href 格式不一致, 改用檔名比對 spine items 後再導覽,並補上翻頁忙碌鎖避免與其他導覽動作衝突 - 修正翻到書尾頁碼與總頁數對不上、Android 書中間頁碼被誤鎖住等問題 - 統一閱讀頁與書櫃卡片的進度百分比計算來源,避免兩處顯示數字不一致 - 移除開發過程中新增的診斷用 debug log Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 2 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR reworks the reader's page/progress computation to use a hidden epub.js rendition scan across linear spine items instead of location-based estimation, fixes TOC navigation targeting, aligns reader footer percentage with library card percentage, updates message types, adds a page progress UI, and removes temporary debug logging. ChangesReader Page Progress and Navigation Fix
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant ReaderUI as reader/[id].tsx
participant WebView as reader-web/index.ts
participant Rendition as HiddenRendition
ReaderUI->>WebView: load book, display initial location
WebView->>Rendition: scanAllChapterPages (delayed background)
Rendition->>WebView: displayed.total per linear chapter
WebView->>WebView: set chapterPageCounts, locationsReady
WebView->>WebView: postRelocated (recompute using scanned totals)
WebView->>ReaderUI: relocated { page, total, percentage }
ReaderUI->>ReaderUI: update pageInfo, render progress bar
sequenceDiagram
participant ReaderUI as reader/[id].tsx
participant WebView as reader-web/index.ts
participant Rendition as EpubRendition
ReaderUI->>WebView: goto message { target }
WebView->>WebView: resolveNavTarget(target)
WebView->>WebView: wait for navigation busy lock
WebView->>Rendition: display(resolved href)
Rendition->>WebView: relocated event
WebView->>ReaderUI: postRelocated payload
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 `@mobile/reader-web/index.ts`:
- Around line 37-48: Reset the pagination globals per loaded book and guard the
delayed scan so it cannot write stale state after a new book is opened. In
`loadBook`, clear `chapterPageCounts`, `locationsReady`, `lastRelocatedLoc`, and
`lastLinearSpineIndex` when starting a new book, and in `scanAllChapterPages`
capture the current `book`/generation before the async work and skip the final
`chapterPageCounts` assignment if it no longer matches. Also make sure the
downstream pagination path that uses `postRelocated` only reads the current
book’s state, not values left over from a previous load.
- Around line 353-363: The spine href resolution logic is stripping off TOC
anchor fragments during matching, then returning only the resolved spine href,
which loses the original `#fragment`. Update the href resolution around the
cleanHref/spineItem lookup so it preserves any fragment from target when
returning the resolved href, while still matching against the fragment-free path
for spine item lookup. Keep the fix localized to the same resolver that uses
target, cleanHref, filename, and spineItem.
- Around line 482-484: The hidden offscreen rendition created in the renderTo
flow is currently enabling scripted content, which should stay disabled for the
whole-book scan. Update the hidden rendition setup in the renderTo call to keep
allowScriptedContent off by default, and only enable it behind a targeted
fallback for EPUBs that cannot paginate otherwise. Use the hiddenRendition
creation path in the reader-web index logic to make the change.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 2a9d430b-a171-4d48-9f81-13f2a82af46d
📒 Files selected for processing (5)
RN_SETUP_GUIDE.mdmobile/app/reader/[id].tsxmobile/lib/readerHtml.generated.tsmobile/lib/readerMessages.tsmobile/reader-web/index.ts
- loadBook 換書時重置分頁狀態並用 loadGeneration 防止舊書背景掃描覆寫新書資料 - resolveNavTarget 解析 spine href 時保留原本的 #fragment 錨點 - scanAllChapterPages 的隱藏渲染預設關閉 allowScriptedContent,僅在掃不出頁數時才 fallback 開啟 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Summary by CodeRabbit
New Features
Bug Fixes