mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 05:23:44 +08:00
fix: auto scroll into view when sorted proxies changed
This commit is contained in:
parent
14f627d0d3
commit
532c6d4fa5
@ -111,9 +111,18 @@ const ProxyGroup = ({ group }: Props) => {
|
||||
// auto scroll to current index
|
||||
useEffect(() => {
|
||||
if (headState.open) {
|
||||
setTimeout(() => onLocation(false), 5);
|
||||
setTimeout(() => onLocation(false), 10);
|
||||
}
|
||||
}, [headState.open]);
|
||||
}, [headState.open, sortedProxies]);
|
||||
|
||||
// auto scroll when sorted changed
|
||||
const timerRef = useRef<any>();
|
||||
useEffect(() => {
|
||||
if (headState.open) {
|
||||
clearTimeout(timerRef.current);
|
||||
timerRef.current = setTimeout(() => onLocation(false), 500);
|
||||
}
|
||||
}, [headState.open, sortedProxies]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
Loading…
x
Reference in New Issue
Block a user