fix: when use LogViewer with big size(more then 30M maybe) logs cause maximun call stack error

Signed-off-by: rui ma <ruima@alauda.io>
This commit is contained in:
rui ma
2023-12-19 12:13:13 +08:00
parent 199e660972
commit 66401c1f27
@@ -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);
}