Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Web enh: Add timeout to highlight/scroll

Kilian Lieretc128078d8c78
diff --git a/sweagent/frontend/src/Run.js b/sweagent/frontend/src/Run.js
index 74c1616e..f45050cd 100644
--- a/sweagent/frontend/src/Run.js
+++ b/sweagent/frontend/src/Run.js
@@ -24,6 +24,8 @@ function Run() {
const [logs, setLogs] = useState('');
const [isComputing, setIsComputing] = useState(false);
+ const hoverTimeoutRef = useRef(null);
+
const [isTerminalExpanded, setIsTerminalExpanded] = useState(false);
const [isLogsExpanded, setIsLogsExpanded] = useState(false);
@@ -54,15 +56,29 @@ function Run() {
}
const handleMouseEnter = (item, feedRef) => {
+ if (isComputing) {
+ return;
+ }
+
const highlightedStep = item.step;
- if (!isComputing) {
- setHighlightedStep(highlightedStep);
- scrollToHighlightedStep(highlightedStep, getOtherFeed(feedRef));
+
+ if (hoverTimeoutRef.current) {
+ clearTimeout(hoverTimeoutRef.current);
}
+
+ hoverTimeoutRef.current = setTimeout(() => {
+ if (!isComputing) {
+ setHighlightedStep(highlightedStep);
+ scrollToHighlightedStep(highlightedStep, getOtherFeed(feedRef));
+ }
+ }, 250);
};
const handleMouseLeave = () => {
console.log('Mouse left');
+ if (hoverTimeoutRef.current) {
+ clearTimeout(hoverTimeoutRef.current);
+ }
setHighlightedStep(null);
}