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 Fix: Every message to appear only once

Kilian Lieretc5d6e748c0fa
diff --git a/sweagent/frontend/src/App.js b/sweagent/frontend/src/App.js
index 359c4423..f417cb5e 100644
--- a/sweagent/frontend/src/App.js
+++ b/sweagent/frontend/src/App.js
@@ -38,10 +38,16 @@ function App() {
// Use effect to listen to socket updates
React.useEffect(() => {
- socket.on('update', (data) => {
+ const handleUpdate = (data) => {
const updateFeed = data.feed === 'agent' ? setAgentFeed : setEnvFeed;
updateFeed(prevMessages => [...prevMessages, { title: data.title, message: data.message, format: data.format, step: data.thought_idx }]);
- });
+ };
+
+ socket.on('update', handleUpdate);
+
+ return () => {
+ socket.off('update', handleUpdate);
+ };
}, []);
return (