Repository navigation
[codex] Use catalog API for iOS history - #18
Conversation
📝 WalkthroughWalkthroughA new ChangesPaginated Watch History
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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 `@iosApp/iosApp/Screens/Personal/HistoryView.swift`:
- Around line 98-101: The totalItems property is not being cleared when
response.totalExact is false, causing the countLabel to display stale data from
previous responses. In the conditional block where response.totalExact == false
is checked (around line 122), add a line to reset totalItems to nil alongside
the other state resets like hasMore, nextOffset, and snapshot. This ensures that
when the total count is not exact, the old exact total value is cleared and
won't be displayed in the countLabel after refresh or pagination state changes.
🪄 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: fcbc0b0d-9379-4be2-9a7e-67c78d655e21
📒 Files selected for processing (2)
iosApp/iosApp/Networking/ContinuumAPI.swiftiosApp/iosApp/Screens/Personal/HistoryView.swift
Move the History screen's loading/paging logic out of the view into an @observable HistoryViewModel, matching the BrowseViewModel pattern. - Defer the paging-cursor reset until a refresh succeeds: a failed pull-to-refresh previously zeroed the offset/snapshot while keeping the stale list, so the next load-more re-fetched and duplicated page 1. The cursor is now committed only on success, and kept intact on error so load-more resumes correctly. - Collapse the item-count label into a single readable expression. Built Silo (iOS) and SiloTV (tvOS) schemes with code signing disabled. Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
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 `@iosApp/iosApp/Screens/Personal/HistoryViewModel.swift`:
- Around line 97-100: In the advanceCursor method, the condition checking
response.totalExact is incorrectly using `!= false` which evaluates to true when
totalExact is nil, causing omitted counts from load-more responses to overwrite
previously-known exact totals. Change the condition from `response.totalExact !=
false` to `response.totalExact == true` to only update the totalItems when the
server explicitly confirms exactness.
🪄 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: 2c4f6f4e-d2aa-4164-b7a6-d943ac1b7fea
📒 Files selected for processing (2)
iosApp/iosApp/Screens/Personal/HistoryView.swiftiosApp/iosApp/Screens/Personal/HistoryViewModel.swift
| private func advanceCursor(with response: CatalogResponse, from requestOffset: Int) { | ||
| if response.totalExact != false { | ||
| totalItems = response.total | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor
🧩 Analysis chain
🏁 Script executed:
cat -n iosApp/iosApp/Screens/Personal/HistoryViewModel.swift | head -120 | tail -40
Repository: Silo-Server/silo-apple
Length of output: 2035
🏁 Script executed:
find . -type f -name "*.swift" | xargs grep -l "CatalogResponse" | head -5
Repository: Silo-Server/silo-apple
Length of output: 420
🏁 Script executed:
grep -A 10 "struct CatalogResponse" iosApp/iosApp/Networking/Models.swift
Repository: Silo-Server/silo-apple
Length of output: 470
🏁 Script executed:
grep -B 5 -A 15 "var totalExact" iosApp/iosApp/Networking/Models.swift
Repository: Silo-Server/silo-apple
Length of output: 160
Change condition to check explicitly for true to avoid overwriting exact totals with omitted values.
In advanceCursor, the condition response.totalExact != false evaluates to true when totalExact is nil, causing Line 99 to overwrite a previously-known exact total with a placeholder from load-more responses that omit the count. Per the method's intent (documented in the comment), omitted counts should not disturb a pinned exact total. Change the condition to response.totalExact == true to only update when the server explicitly confirms exactness.
Suggested fix
private func advanceCursor(with response: CatalogResponse, from requestOffset: Int) {
- if response.totalExact != false {
+ if response.totalExact == true {
totalItems = response.total
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| private func advanceCursor(with response: CatalogResponse, from requestOffset: Int) { | |
| if response.totalExact != false { | |
| totalItems = response.total | |
| } | |
| private func advanceCursor(with response: CatalogResponse, from requestOffset: Int) { | |
| if response.totalExact == true { | |
| totalItems = response.total | |
| } |
🤖 Prompt for 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.
In `@iosApp/iosApp/Screens/Personal/HistoryViewModel.swift` around lines 97 - 100,
In the advanceCursor method, the condition checking response.totalExact is
incorrectly using `!= false` which evaluates to true when totalExact is nil,
causing omitted counts from load-more responses to overwrite previously-known
exact totals. Change the condition from `response.totalExact != false` to
`response.totalExact == true` to only update the totalItems when the server
explicitly confirms exactness.
Summary
limit,offset, and catalog snapshots so the full watch history loads while scrolling.Validation
git diff --check.Summary by CodeRabbit