fix(beats): flush viewport beats before PTR refresh#35
fix(beats): flush viewport beats before PTR refresh#35CasparChou wants to merge 1 commit intomasterfrom
Conversation
merge the auto-mark-as-read and ptr iifes into one closure so they share the `sent` set. add flushvisible() that synchronously posts view for every card intersecting the viewport before htmx.ajax fires on touchend. previously the 1.5s intersectionobserver timer reset on htmx:aftersettle meant ptr triggered before any view was sent, so already-read beats at the top of the viewport survived the refresh.
|
Claude finished @CasparChou's task —— View job Code Review CompleteReviewing PR: fix(beats): flush viewport beats before PTR refresh Todo List:
Code Review Findings✅ Overall AssessmentThis is a well-thought-out fix that solves a legitimate race condition issue. The solution is elegant and maintains good code organization. 🏆 Strengths
🔍 Code Quality ObservationsGood Practices:
Minor Style Notes:
🐛 Potential IssuesLow Priority:
🚀 Performance ConsiderationsPositive:
Neutral:
🔒 Security Assessment✅ Secure:
🧪 Test Coverage RecommendationsSince this involves complex timing and user interaction:
🎯 Suggestions for Future Improvements
📝 Technical Implementation NotesThe fix addresses the core issue described in the PR:
The implementation is solid and follows established patterns in the codebase. Verdict: ✅ APPROVED - This is a well-implemented fix that solves the described race condition without introducing new issues. The code quality is high and the approach is sound. |
Coverage Report for CI Build 24920604958Coverage remained the same at 75.827%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Summary
sentSetflushVisible()that synchronously firesPOST /api/v1/beats/{id}/viewfor every card intersecting the viewport beforehtmx.ajaxruns on touchend