Merge pull request #1817 from Rxflex/patch-1

limit rawLogs to max number of lines by trimming old entries
This commit is contained in:
Mauricio Siu 2025-05-04 20:00:49 -06:00 committed by GitHub
commit 7e365e1947
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -140,7 +140,14 @@ export const DockerLogsId: React.FC<Props> = ({
ws.onmessage = (e) => {
if (!isCurrentConnection) return;
setRawLogs((prev) => prev + e.data);
setRawLogs((prev) => {
const updated = prev + e.data;
const splitLines = updated.split("\n");
if (splitLines.length > lines) {
return splitLines.slice(-lines).join("\n");
}
return updated;
});
setIsLoading(false);
if (noDataTimeout) clearTimeout(noDataTimeout);
};