clean up follow mode quirks

This commit is contained in:
Keith J. Grant
2022-11-07 11:19:45 -08:00
committed by Keith J. Grant
parent 6f6f04a071
commit 03b0281fde

View File

@@ -187,7 +187,9 @@ function JobOutput({ job, eventRelatedSearchableKeys, eventSearchableKeys }) {
useEffect(() => { useEffect(() => {
const pendingRequests = Object.values(eventByUuidRequests.current || {}); const pendingRequests = Object.values(eventByUuidRequests.current || {});
setHasContentLoading(true); // prevents "no content found" screen from flashing setHasContentLoading(true); // prevents "no content found" screen from flashing
setIsFollowModeEnabled(false); if (location.search) {
setIsFollowModeEnabled(false);
}
Promise.allSettled(pendingRequests).then(() => { Promise.allSettled(pendingRequests).then(() => {
setRemoteRowCount(0); setRemoteRowCount(0);
clearLoadedEvents(); clearLoadedEvents();
@@ -635,10 +637,14 @@ function JobOutput({ job, eventRelatedSearchableKeys, eventSearchableKeys }) {
setIsFollowModeEnabled(false); setIsFollowModeEnabled(false);
}; };
const scrollToEnd = () => { const scrollToEnd = useCallback(() => {
scrollToRow(-1); scrollToRow(-1);
setTimeout(() => scrollToRow(-1), 100); let timeout;
}; if (isFollowModeEnabled) {
setTimeout(() => scrollToRow(-1), 100);
}
return () => clearTimeout(timeout);
}, [isFollowModeEnabled]);
const handleScrollLast = () => { const handleScrollLast = () => {
scrollToEnd(); scrollToEnd();