From 66401c1f27c8c842fb7906ac39b7be956a3485ea Mon Sep 17 00:00:00 2001 From: rui ma Date: Tue, 19 Dec 2023 12:13:13 +0800 Subject: [PATCH] fix: when use LogViewer with big size(more then 30M maybe) logs cause maximun call stack error Signed-off-by: rui ma --- .../core-components/src/components/LogViewer/AnsiProcessor.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core-components/src/components/LogViewer/AnsiProcessor.ts b/packages/core-components/src/components/LogViewer/AnsiProcessor.ts index d0f835a70e..bcd5af7ced 100644 --- a/packages/core-components/src/components/LogViewer/AnsiProcessor.ts +++ b/packages/core-components/src/components/LogViewer/AnsiProcessor.ts @@ -117,7 +117,7 @@ export class AnsiProcessor { return this.lines; } - if (text.startsWith(this.text)) { + if (this.text && text.startsWith(this.text)) { const lastLineIndex = this.lines.length > 0 ? this.lines.length - 1 : 0; const lastLine = this.lines[lastLineIndex] ?? new AnsiLine(); const lastChunk = lastLine.lastChunk(); @@ -130,7 +130,7 @@ export class AnsiProcessor { lastLine.replaceLastChunk(newLines[0]?.chunks); this.lines[lastLineIndex] = lastLine; - this.lines.push(...newLines.slice(1)); + this.lines = this.lines.concat(newLines.slice(1)); } else { this.lines = this.processLines(text); }