mirror of
https://github.com/dergigi/boris.git
synced 2025-12-17 06:34:24 +01:00
refactor(reading): increase debounce to 3 seconds
This commit is contained in:
@@ -16,8 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Reading position auto-save now uses simple 2-second debounce
|
- Reading position auto-save now uses simple 3-second debounce
|
||||||
- Saves only after 2s of no scrolling (was 15s minimum interval)
|
- Saves only after 3s of no scrolling (was 15s minimum interval)
|
||||||
- Much less aggressive, reduces relay traffic
|
- Much less aggressive, reduces relay traffic
|
||||||
- Still saves instantly at 100% completion
|
- Still saves instantly at 100% completion
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export const useReadingPosition = ({
|
|||||||
clearTimeout(saveTimerRef.current)
|
clearTimeout(saveTimerRef.current)
|
||||||
}
|
}
|
||||||
|
|
||||||
const DEBOUNCE_MS = 2000 // Save max every 2 seconds
|
const DEBOUNCE_MS = 3000 // Save max every 3 seconds
|
||||||
console.log('[reading-position] ⏱️ Debouncing save for', DEBOUNCE_MS, 'ms (pos:', Math.round(currentPosition * 100) + '%)')
|
console.log('[reading-position] ⏱️ Debouncing save for', DEBOUNCE_MS, 'ms (pos:', Math.round(currentPosition * 100) + '%)')
|
||||||
saveTimerRef.current = setTimeout(() => {
|
saveTimerRef.current = setTimeout(() => {
|
||||||
console.log('[reading-position] 💾 Auto-save at', Math.round(currentPosition * 100) + '%')
|
console.log('[reading-position] 💾 Auto-save at', Math.round(currentPosition * 100) + '%')
|
||||||
|
|||||||
Reference in New Issue
Block a user