mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-01 20:03:30 +02:00
fix(new-chat): remove unused _hasScrolledToCited state in source-detail-panel
The useState was declared but its value was never read in render (only the setter was called). Each setter call scheduled a re-render that changed nothing visible. The actual scroll/highlight behavior is driven by hasScrolledRef and setActiveChunkIndex; this state was effectively dead. Closes #1249
This commit is contained in:
parent
425e1b8830
commit
dbd1706811
1 changed files with 1 additions and 4 deletions
|
|
@ -133,7 +133,6 @@ export function SourceDetailPanel({
|
||||||
const scrollTimersRef = useRef<ReturnType<typeof setTimeout>[]>([]);
|
const scrollTimersRef = useRef<ReturnType<typeof setTimeout>[]>([]);
|
||||||
const [activeChunkIndex, setActiveChunkIndex] = useState<number | null>(null);
|
const [activeChunkIndex, setActiveChunkIndex] = useState<number | null>(null);
|
||||||
const [mounted, setMounted] = useState(false);
|
const [mounted, setMounted] = useState(false);
|
||||||
const [_hasScrolledToCited, setHasScrolledToCited] = useState(false);
|
|
||||||
const shouldReduceMotion = useReducedMotion();
|
const shouldReduceMotion = useReducedMotion();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -322,11 +321,10 @@ export function SourceDetailPanel({
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// After final attempt, mark state as scrolled
|
// After final attempt, mark the cited chunk as active
|
||||||
scrollTimersRef.current.push(
|
scrollTimersRef.current.push(
|
||||||
setTimeout(
|
setTimeout(
|
||||||
() => {
|
() => {
|
||||||
setHasScrolledToCited(true);
|
|
||||||
setActiveChunkIndex(citedChunkIndex);
|
setActiveChunkIndex(citedChunkIndex);
|
||||||
},
|
},
|
||||||
scrollAttempts[scrollAttempts.length - 1] + 50
|
scrollAttempts[scrollAttempts.length - 1] + 50
|
||||||
|
|
@ -343,7 +341,6 @@ export function SourceDetailPanel({
|
||||||
scrollTimersRef.current.forEach(clearTimeout);
|
scrollTimersRef.current.forEach(clearTimeout);
|
||||||
scrollTimersRef.current = [];
|
scrollTimersRef.current = [];
|
||||||
hasScrolledRef.current = false;
|
hasScrolledRef.current = false;
|
||||||
setHasScrolledToCited(false);
|
|
||||||
setActiveChunkIndex(null);
|
setActiveChunkIndex(null);
|
||||||
}
|
}
|
||||||
return () => {
|
return () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue