Skip to content
Snippets Groups Projects
Unverified Commit 59dae640 authored by GyDi's avatar GyDi
Browse files

fix: auto scroll into view when sorted proxies changed

parent a6ac75e9
No related branches found
No related tags found
No related merge requests found
...@@ -111,9 +111,18 @@ const ProxyGroup = ({ group }: Props) => { ...@@ -111,9 +111,18 @@ const ProxyGroup = ({ group }: Props) => {
// auto scroll to current index // auto scroll to current index
useEffect(() => { useEffect(() => {
if (headState.open) { 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 ( return (
<> <>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment