Feature Description
The useScrollSync hook currently contains a TODO saying we should consider replacing setTimeout with requestAnimationFrame, but the implementation already uses requestAnimationFrame as the primary path and only falls back to setTimeout.
Problem Statement
This outdated TODO creates confusion for maintainers and reviewers, because comments no longer reflect the actual behavior. It also increases cognitive load when debugging scroll-sync behavior.
Proposed Solution
- Remove or rewrite the outdated TODO comment in
src/renderer/pages/conversation/Preview/hooks/useScrollSync.ts.
- Keep a concise note explaining the current strategy:
- prefer
requestAnimationFrame
- fallback to
setTimeout for compatibility/safe degradation
- Ensure Chinese/English comments remain semantically consistent.
Feature Category
UI/UX Improvement
Additional Context
Relevant lines:
- Outdated TODO comment: lines 62–63
- Existing
requestAnimationFrame implementation: lines 87–92
- Fallback
setTimeout: lines 95–98