mirror of
https://github.com/dergigi/boris.git
synced 2026-02-23 07:54:59 +01:00
fix(reading-position): prevent tracking from toggling on/off
Added logic to properly disable tracking when isTextContent becomes false. This prevents the tracking state from flipping and ensures saves work consistently. Now tracking is only enabled once content is stable and stays enabled until the article changes or content becomes unsuitable.
This commit is contained in:
@@ -221,9 +221,18 @@ const ContentPanel: React.FC<ContentPanelProps> = ({
|
||||
setIsTrackingEnabled(false)
|
||||
}, [selectedUrl])
|
||||
|
||||
// Enable tracking after content is stable
|
||||
// Enable/disable tracking based on content state
|
||||
useEffect(() => {
|
||||
if (isTextContent && !isTrackingEnabled) {
|
||||
if (!isTextContent) {
|
||||
// Disable tracking if content is not suitable
|
||||
if (isTrackingEnabled) {
|
||||
console.log('[reading-position] ⏸️ Disabling tracking (not text content)')
|
||||
setIsTrackingEnabled(false)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (!isTrackingEnabled) {
|
||||
// Wait 500ms after content loads before enabling tracking
|
||||
const timer = setTimeout(() => {
|
||||
console.log('[reading-position] ✅ Enabling tracking after stability delay')
|
||||
|
||||
Reference in New Issue
Block a user