From 66401c1f27c8c842fb7906ac39b7be956a3485ea Mon Sep 17 00:00:00 2001 From: rui ma Date: Tue, 19 Dec 2023 12:13:13 +0800 Subject: [PATCH 1/3] 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); } From 752df9315b1ac7c79e4e4de6c8865b170d5c6725 Mon Sep 17 00:00:00 2001 From: rui ma Date: Tue, 19 Dec 2023 12:17:07 +0800 Subject: [PATCH 2/3] fix: add changeset Signed-off-by: rui ma --- .changeset/honest-hounds-exist.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/honest-hounds-exist.md diff --git a/.changeset/honest-hounds-exist.md b/.changeset/honest-hounds-exist.md new file mode 100644 index 0000000000..56fb9a2734 --- /dev/null +++ b/.changeset/honest-hounds-exist.md @@ -0,0 +1,5 @@ +--- +'@backstage/core-components': patch +--- + +when use LogViewer with big size(more then 30M maybe) logs cause maximun call stack error From d88388a586fc63b40de23b6d97bd7536fd40f77c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Tue, 19 Dec 2023 10:38:15 +0100 Subject: [PATCH 3/3] Update .changeset/honest-hounds-exist.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/honest-hounds-exist.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/honest-hounds-exist.md b/.changeset/honest-hounds-exist.md index 56fb9a2734..59219e98af 100644 --- a/.changeset/honest-hounds-exist.md +++ b/.changeset/honest-hounds-exist.md @@ -2,4 +2,4 @@ '@backstage/core-components': patch --- -when use LogViewer with big size(more then 30M maybe) logs cause maximun call stack error +Fixes a problem where the `LogViewer` was not able to handle very large logs