Skip to content

Commit a30cce3

Browse files
fix: Resolve infinite loop in status updates
- Remove containerStatusMutation from fetchContainerStatuses dependencies - Use empty dependency array for fetchContainerStatuses useCallback - Remove fetchContainerStatuses from useEffect dependencies - Only depend on scripts.length to prevent infinite loops - Status updates now run only when scripts change, not on every render
1 parent 6deeab9 commit a30cce3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/app/_components/InstalledScriptsTab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ export function InstalledScriptsTab() {
322322
if (serverIds.length > 0) {
323323
containerStatusMutation.mutate({ serverIds });
324324
}
325-
}, [containerStatusMutation]); // No dependencies to prevent infinite loops
325+
}, []); // Empty dependency array to prevent infinite loops
326326

327327
// Run cleanup when component mounts and scripts are loaded (only once)
328328
useEffect(() => {
@@ -341,7 +341,7 @@ export function InstalledScriptsTab() {
341341
if (scripts.length > 0) {
342342
fetchContainerStatuses();
343343
}
344-
}, [scripts.length, fetchContainerStatuses]); // Include dependencies
344+
}, [scripts.length]); // Only depend on scripts.length to prevent infinite loops
345345

346346
// Update scripts with container statuses
347347
const scriptsWithStatus = scripts.map(script => ({

0 commit comments

Comments
 (0)