limit rawLogs to max number of lines by trimming old entries

https://github.com/Dokploy/dokploy/issues/1815
This commit is contained in:
Andy 2025-05-05 02:10:34 +02:00 committed by GitHub
parent c13a68dab4
commit 3ec339fc89
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);
};