Skip to content

Commit

Permalink
front: truncate large compare outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Sep 17, 2024
1 parent 4b4401e commit c1f204e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions web/src/components/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import init, { RuleSetJs, compare_rulesets_js } from "../../typing_rust_patterns

await init({});

const truncateAt = 300;

addEventListener("message", async (event) => {
const data = event.data;
switch (data.type) {
Expand All @@ -12,6 +14,11 @@ addEventListener("message", async (event) => {
data.patDepth,
data.tyDepth,
);
if (output.length > truncateAt) {
const diff = output.length - truncateAt;
output.length = truncateAt;
output.push({ req: `and ${diff} more...` })
}
postMessage({ type: "compare", output });
break;
}
Expand Down

0 comments on commit c1f204e

Please sign in to comment.